[Kimchi-devel] [PATCH v3][Kimchi] Add support for websockify 0.7
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Wed Jan 20 13:34:37 UTC 2016
The lastest update of websockify changes how the class instantiate
WebSocketProxy.
Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
Changes:
v2:
Change variable name
Instead of create params dictionary from begining, just append the changes
v3:
Rebase over last master
vnc.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/vnc.py b/vnc.py
index 9a25f50..4f94ab2 100644
--- a/vnc.py
+++ b/vnc.py
@@ -21,12 +21,20 @@
import base64
import errno
import os
+
from multiprocessing import Process
from websockify import WebSocketProxy
from wok.config import config, paths, PluginPaths
+try:
+ from websockify.token_plugins import TokenFile
+ tokenFile = True
+except ImportError:
+ tokenFile = False
+
+
WS_TOKENS_DIR = os.path.join(PluginPaths('kimchi').state_dir, 'vnc-tokens')
@@ -45,9 +53,16 @@ def new_ws_proxy():
params = {'listen_host': '127.0.0.1',
'listen_port': config.get('server', 'websockets_port'),
- 'target_cfg': WS_TOKENS_DIR,
'ssl_only': False}
+ # old websockify: do not use TokenFile
+ if not tokenFile:
+ params['target_cfg'] = WS_TOKENS_DIR
+
+ # websockify 0.7 and higher: use TokenFile
+ else:
+ params['token_plugin'] = TokenFile(src=WS_TOKENS_DIR)
+
def start_proxy():
server = WebSocketProxy(**params)
server.start_server()
--
2.1.0
More information about the Kimchi-devel
mailing list