[PATCH WOK 0/2] Update Kimchi and Wok dependencies

Aline Manera (2): Move vnc.py to Kimchi plugin Remove unnecessary dependencies from Wok and Kimchi Makefile.am | 2 - contrib/DEBIAN/control.in | 4 -- contrib/wok.spec.fedora.in | 12 ----- contrib/wok.spec.suse.in | 5 -- plugins/kimchi/Makefile.am | 4 +- plugins/kimchi/contrib/DEBIAN/control.in | 6 --- plugins/kimchi/contrib/kimchi.spec.fedora.in | 9 +--- plugins/kimchi/contrib/kimchi.spec.suse.in | 10 +--- plugins/kimchi/model/vms.py | 2 +- plugins/kimchi/root.py | 2 +- plugins/kimchi/vnc.py | 77 ++++++++++++++++++++++++++++ src/wok/vnc.py | 77 ---------------------------- 12 files changed, 86 insertions(+), 124 deletions(-) create mode 100644 plugins/kimchi/vnc.py delete mode 100644 src/wok/vnc.py -- 2.1.0

vnc.py is related to noVNC configuration and should not be in wok framework. Move it to Kimchi and adjust the imports and build process accordingly. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- Makefile.am | 2 - contrib/wok.spec.fedora.in | 1 - contrib/wok.spec.suse.in | 1 - plugins/kimchi/Makefile.am | 4 +- plugins/kimchi/contrib/kimchi.spec.fedora.in | 3 +- plugins/kimchi/contrib/kimchi.spec.suse.in | 4 +- plugins/kimchi/model/vms.py | 2 +- plugins/kimchi/root.py | 2 +- plugins/kimchi/vnc.py | 77 ++++++++++++++++++++++++++++ src/wok/vnc.py | 77 ---------------------------- 10 files changed, 86 insertions(+), 87 deletions(-) create mode 100644 plugins/kimchi/vnc.py delete mode 100644 src/wok/vnc.py diff --git a/Makefile.am b/Makefile.am index ab5b7d8..c7914d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,6 @@ all-local: install-deb: install cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/ - mkdir -p $(DESTDIR)/var/lib/wok/vnc-tokens touch $(DESTDIR)/var/lib/wok/objectstore $(MKDIR_P) $(DESTDIR)/etc/init $(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services @@ -124,7 +123,6 @@ install-data-local: mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \ $(INSTALL_DATA) src/firewalld.xml $(DESTDIR)/usr/lib/firewalld/services/wokd.xml; \ fi; \ - mkdir -p $(DESTDIR)/var/lib/wok/vnc-tokens touch $(DESTDIR)/var/lib/wok/objectstore mkdir -p $(DESTDIR)/var/log/wok/ touch $(DESTDIR)/var/log/wok/wok-access.log diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in index 30319a9..037e705 100644 --- a/contrib/wok.spec.fedora.in +++ b/contrib/wok.spec.fedora.in @@ -127,7 +127,6 @@ rm -rf $RPM_BUILD_ROOT %if 0%{?with_systemd} %{_sysconfdir}/nginx/conf.d/wok.conf -%{_sharedstatedir}/wok/vnc-tokens/ %{_sharedstatedir}/wok/ %{_localstatedir}/log/wok/* %{_localstatedir}/log/wok/ diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in index 63bdce3..6bff10a 100644 --- a/contrib/wok.spec.suse.in +++ b/contrib/wok.spec.suse.in @@ -93,7 +93,6 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/wok/ %{_sysconfdir}/nginx/conf.d/wok.conf.in %{_sysconfdir}/nginx/conf.d/wok.conf -%{_var}/lib/wok/vnc-tokens/ %{_var}/lib/wok/ %{_localstatedir}/log/wok/* %{_localstatedir}/log/wok/ diff --git a/plugins/kimchi/Makefile.am b/plugins/kimchi/Makefile.am index faef341..49c835e 100644 --- a/plugins/kimchi/Makefile.am +++ b/plugins/kimchi/Makefile.am @@ -98,6 +98,7 @@ config.py: config.py.in Makefile install-deb: install cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/ + mkdir -p $(DESTDIR)/var/lib/kimchi/vnc-tokens mkdir -p $(DESTDIR)/var/lib/kimchi/debugreports mkdir -p $(DESTDIR)/var/lib/kimchi/screenshots mkdir -p $(DESTDIR)/var/lib/kimchi/isos @@ -138,7 +139,8 @@ ChangeLog: install-data-local: $(MKDIR_P) $(DESTDIR)$(kimchidir) $(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json - mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,isos} + mkdir -p $(DESTDIR)/var/lib/kimchi/vnc-tokens + mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,isos,screenshots} uninstall-local: $(RM) $(DESTDIR)$(kimchidir)/API.json diff --git a/plugins/kimchi/contrib/kimchi.spec.fedora.in b/plugins/kimchi/contrib/kimchi.spec.fedora.in index 7a7a447..fa53980 100644 --- a/plugins/kimchi/contrib/kimchi.spec.fedora.in +++ b/plugins/kimchi/contrib/kimchi.spec.fedora.in @@ -102,8 +102,9 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/kimchi/distros.d/gentoo.json %{_sysconfdir}/kimchi/ %{_sharedstatedir}/kimchi/debugreports/ -%{_sharedstatedir}/kimchi/screenshots/ %{_sharedstatedir}/kimchi/isos/ +%{_sharedstatedir}/kimchi/screenshots/ +%{_sharedstatedir}/kimchi/vnc-tokens/ %{_sharedstatedir}/kimchi/ diff --git a/plugins/kimchi/contrib/kimchi.spec.suse.in b/plugins/kimchi/contrib/kimchi.spec.suse.in index 1ab2e5f..9b55c7b 100644 --- a/plugins/kimchi/contrib/kimchi.spec.suse.in +++ b/plugins/kimchi/contrib/kimchi.spec.suse.in @@ -89,12 +89,12 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/kimchi/distros.d/gentoo.json %{_sysconfdir}/kimchi/ %{_var}/lib/kimchi/debugreports/ -%{_var}/lib/kimchi/screenshots/ %{_var}/lib/kimchi/isos/ +%{_var}/lib/kimchi/screenshots/ +%{_var}/lib/kimchi/vnc-tokens/ %{_var}/lib/kimchi/ - %changelog * Thu Jun 18 2015 Lucio Correia <luciojhc@linux.vnet.ibm.com> 1.6 - Run kimchi as a plugin diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py index 36e3cd2..f446e80 100644 --- a/plugins/kimchi/model/vms.py +++ b/plugins/kimchi/model/vms.py @@ -28,7 +28,6 @@ from lxml import etree, objectify from lxml.builder import E from xml.etree import ElementTree -from wok import vnc from wok.config import config from wok.exception import InvalidOperation, InvalidParameter from wok.exception import NotFoundError, OperationFailed @@ -39,6 +38,7 @@ from wok.xmlutils.utils import xpath_get_text, xml_item_update from wok.xmlutils.utils import dictize from .. import model +from .. import vnc from ..config import READONLY_POOL_TYPE from ..kvmusertests import UserTests from ..screenshot import VMScreenshot diff --git a/plugins/kimchi/root.py b/plugins/kimchi/root.py index fb2f966..1e2bfc7 100644 --- a/plugins/kimchi/root.py +++ b/plugins/kimchi/root.py @@ -21,12 +21,12 @@ import json import os import cherrypy -from wok import vnc from wok.i18n import messages from wok.root import WokRoot import config import mockmodel +import vnc from control import sub_nodes from model import model as kimchiModel diff --git a/plugins/kimchi/vnc.py b/plugins/kimchi/vnc.py new file mode 100644 index 0000000..2532449 --- /dev/null +++ b/plugins/kimchi/vnc.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python2 +# +# Project Kimchi +# +# Copyright IBM, Corp. 2013-2015 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import base64 +import errno +import os +from multiprocessing import Process +from websockify import WebSocketProxy + +from wok.config import config, paths + + +WS_TOKENS_DIR = '/var/lib/wok/vnc-tokens' + + +def new_ws_proxy(): + try: + os.makedirs(WS_TOKENS_DIR, mode=0755) + except OSError as e: + if e.errno == errno.EEXIST: + pass + + cert = config.get('server', 'ssl_cert') + key = config.get('server', 'ssl_key') + if not (cert and key): + cert = '%s/wok-cert.pem' % paths.conf_dir + key = '%s/wok-key.pem' % paths.conf_dir + + params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'), + 'listen_port': config.get('display', 'display_proxy_port'), + 'target_cfg': WS_TOKENS_DIR, + 'key': key, 'cert': cert, 'ssl_only': True} + + def start_proxy(): + server = WebSocketProxy(**params) + server.start_server() + + proc = Process(target=start_proxy) + proc.start() + return proc + + +def add_proxy_token(name, port): + with open(os.path.join(WS_TOKENS_DIR, name), 'w') as f: + """ + From python documentation base64.urlsafe_b64encode(s) + substitutes - instead of + and _ instead of / in the + standard Base64 alphabet, BUT the result can still + contain = which is not safe in a URL query component. + So remove it when needed as base64 can work well without it. + """ + name = base64.urlsafe_b64encode(name).rstrip('=') + f.write('%s: localhost:%s' % (name.encode('utf-8'), port)) + + +def remove_proxy_token(name): + try: + os.unlink(os.path.join(WS_TOKENS_DIR, name)) + except OSError: + pass diff --git a/src/wok/vnc.py b/src/wok/vnc.py deleted file mode 100644 index 2532449..0000000 --- a/src/wok/vnc.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python2 -# -# Project Kimchi -# -# Copyright IBM, Corp. 2013-2015 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -import base64 -import errno -import os -from multiprocessing import Process -from websockify import WebSocketProxy - -from wok.config import config, paths - - -WS_TOKENS_DIR = '/var/lib/wok/vnc-tokens' - - -def new_ws_proxy(): - try: - os.makedirs(WS_TOKENS_DIR, mode=0755) - except OSError as e: - if e.errno == errno.EEXIST: - pass - - cert = config.get('server', 'ssl_cert') - key = config.get('server', 'ssl_key') - if not (cert and key): - cert = '%s/wok-cert.pem' % paths.conf_dir - key = '%s/wok-key.pem' % paths.conf_dir - - params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'), - 'listen_port': config.get('display', 'display_proxy_port'), - 'target_cfg': WS_TOKENS_DIR, - 'key': key, 'cert': cert, 'ssl_only': True} - - def start_proxy(): - server = WebSocketProxy(**params) - server.start_server() - - proc = Process(target=start_proxy) - proc.start() - return proc - - -def add_proxy_token(name, port): - with open(os.path.join(WS_TOKENS_DIR, name), 'w') as f: - """ - From python documentation base64.urlsafe_b64encode(s) - substitutes - instead of + and _ instead of / in the - standard Base64 alphabet, BUT the result can still - contain = which is not safe in a URL query component. - So remove it when needed as base64 can work well without it. - """ - name = base64.urlsafe_b64encode(name).rstrip('=') - f.write('%s: localhost:%s' % (name.encode('utf-8'), port)) - - -def remove_proxy_token(name): - try: - os.unlink(os.path.join(WS_TOKENS_DIR, name)) - except OSError: - pass -- 2.1.0

Reviewed-By: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2015-09-16 at 14:44 -0300, Aline Manera wrote:
vnc.py is related to noVNC configuration and should not be in wok framework.
Move it to Kimchi and adjust the imports and build process accordingly.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- Makefile.am | 2 - contrib/wok.spec.fedora.in | 1 - contrib/wok.spec.suse.in | 1 - plugins/kimchi/Makefile.am | 4 +- plugins/kimchi/contrib/kimchi.spec.fedora.in | 3 +- plugins/kimchi/contrib/kimchi.spec.suse.in | 4 +- plugins/kimchi/model/vms.py | 2 +- plugins/kimchi/root.py | 2 +- plugins/kimchi/vnc.py | 77 ++++++++++++++++++++++++++++ src/wok/vnc.py | 77 ------------------ ---------- 10 files changed, 86 insertions(+), 87 deletions(-) create mode 100644 plugins/kimchi/vnc.py delete mode 100644 src/wok/vnc.py
diff --git a/Makefile.am b/Makefile.am index ab5b7d8..c7914d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,6 @@ all-local:
install-deb: install cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/ - mkdir -p $(DESTDIR)/var/lib/wok/vnc-tokens touch $(DESTDIR)/var/lib/wok/objectstore $(MKDIR_P) $(DESTDIR)/etc/init $(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services @@ -124,7 +123,6 @@ install-data-local: mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \ $(INSTALL_DATA) src/firewalld.xml $(DESTDIR)/usr/lib/firewalld/services/wokd.xml; \ fi; \ - mkdir -p $(DESTDIR)/var/lib/wok/vnc-tokens touch $(DESTDIR)/var/lib/wok/objectstore mkdir -p $(DESTDIR)/var/log/wok/ touch $(DESTDIR)/var/log/wok/wok-access.log diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in index 30319a9..037e705 100644 --- a/contrib/wok.spec.fedora.in +++ b/contrib/wok.spec.fedora.in @@ -127,7 +127,6 @@ rm -rf $RPM_BUILD_ROOT
%if 0%{?with_systemd} %{_sysconfdir}/nginx/conf.d/wok.conf -%{_sharedstatedir}/wok/vnc-tokens/ %{_sharedstatedir}/wok/ %{_localstatedir}/log/wok/* %{_localstatedir}/log/wok/ diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in index 63bdce3..6bff10a 100644 --- a/contrib/wok.spec.suse.in +++ b/contrib/wok.spec.suse.in @@ -93,7 +93,6 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/wok/ %{_sysconfdir}/nginx/conf.d/wok.conf.in %{_sysconfdir}/nginx/conf.d/wok.conf -%{_var}/lib/wok/vnc-tokens/ %{_var}/lib/wok/ %{_localstatedir}/log/wok/* %{_localstatedir}/log/wok/ diff --git a/plugins/kimchi/Makefile.am b/plugins/kimchi/Makefile.am index faef341..49c835e 100644 --- a/plugins/kimchi/Makefile.am +++ b/plugins/kimchi/Makefile.am @@ -98,6 +98,7 @@ config.py: config.py.in Makefile
install-deb: install cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/ + mkdir -p $(DESTDIR)/var/lib/kimchi/vnc-tokens mkdir -p $(DESTDIR)/var/lib/kimchi/debugreports mkdir -p $(DESTDIR)/var/lib/kimchi/screenshots mkdir -p $(DESTDIR)/var/lib/kimchi/isos @@ -138,7 +139,8 @@ ChangeLog: install-data-local: $(MKDIR_P) $(DESTDIR)$(kimchidir) $(INSTALL_DATA) API.json $(DESTDIR)$(kimchidir)/API.json - mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,isos} + mkdir -p $(DESTDIR)/var/lib/kimchi/vnc-tokens + mkdir -p $(DESTDIR)/var/lib/kimchi/{debugreports,isos,screenshots}
uninstall-local: $(RM) $(DESTDIR)$(kimchidir)/API.json diff --git a/plugins/kimchi/contrib/kimchi.spec.fedora.in b/plugins/kimchi/contrib/kimchi.spec.fedora.in index 7a7a447..fa53980 100644 --- a/plugins/kimchi/contrib/kimchi.spec.fedora.in +++ b/plugins/kimchi/contrib/kimchi.spec.fedora.in @@ -102,8 +102,9 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/kimchi/distros.d/gentoo.json %{_sysconfdir}/kimchi/ %{_sharedstatedir}/kimchi/debugreports/ -%{_sharedstatedir}/kimchi/screenshots/ %{_sharedstatedir}/kimchi/isos/ +%{_sharedstatedir}/kimchi/screenshots/ +%{_sharedstatedir}/kimchi/vnc-tokens/ %{_sharedstatedir}/kimchi/
diff --git a/plugins/kimchi/contrib/kimchi.spec.suse.in b/plugins/kimchi/contrib/kimchi.spec.suse.in index 1ab2e5f..9b55c7b 100644 --- a/plugins/kimchi/contrib/kimchi.spec.suse.in +++ b/plugins/kimchi/contrib/kimchi.spec.suse.in @@ -89,12 +89,12 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/kimchi/distros.d/gentoo.json %{_sysconfdir}/kimchi/ %{_var}/lib/kimchi/debugreports/ -%{_var}/lib/kimchi/screenshots/ %{_var}/lib/kimchi/isos/ +%{_var}/lib/kimchi/screenshots/ +%{_var}/lib/kimchi/vnc-tokens/ %{_var}/lib/kimchi/
- %changelog * Thu Jun 18 2015 Lucio Correia <luciojhc@linux.vnet.ibm.com> 1.6 - Run kimchi as a plugin diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py index 36e3cd2..f446e80 100644 --- a/plugins/kimchi/model/vms.py +++ b/plugins/kimchi/model/vms.py @@ -28,7 +28,6 @@ from lxml import etree, objectify from lxml.builder import E from xml.etree import ElementTree
-from wok import vnc from wok.config import config from wok.exception import InvalidOperation, InvalidParameter from wok.exception import NotFoundError, OperationFailed @@ -39,6 +38,7 @@ from wok.xmlutils.utils import xpath_get_text, xml_item_update from wok.xmlutils.utils import dictize
from .. import model +from .. import vnc from ..config import READONLY_POOL_TYPE from ..kvmusertests import UserTests from ..screenshot import VMScreenshot diff --git a/plugins/kimchi/root.py b/plugins/kimchi/root.py index fb2f966..1e2bfc7 100644 --- a/plugins/kimchi/root.py +++ b/plugins/kimchi/root.py @@ -21,12 +21,12 @@ import json import os import cherrypy
-from wok import vnc from wok.i18n import messages from wok.root import WokRoot
import config import mockmodel +import vnc from control import sub_nodes from model import model as kimchiModel
diff --git a/plugins/kimchi/vnc.py b/plugins/kimchi/vnc.py new file mode 100644 index 0000000..2532449 --- /dev/null +++ b/plugins/kimchi/vnc.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python2 +# +# Project Kimchi +# +# Copyright IBM, Corp. 2013-2015 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import base64 +import errno +import os +from multiprocessing import Process +from websockify import WebSocketProxy + +from wok.config import config, paths + + +WS_TOKENS_DIR = '/var/lib/wok/vnc-tokens' + + +def new_ws_proxy(): + try: + os.makedirs(WS_TOKENS_DIR, mode=0755) + except OSError as e: + if e.errno == errno.EEXIST: + pass + + cert = config.get('server', 'ssl_cert') + key = config.get('server', 'ssl_key') + if not (cert and key): + cert = '%s/wok-cert.pem' % paths.conf_dir + key = '%s/wok-key.pem' % paths.conf_dir + + params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'), + 'listen_port': config.get('display', 'display_proxy_port'), + 'target_cfg': WS_TOKENS_DIR, + 'key': key, 'cert': cert, 'ssl_only': True} + + def start_proxy(): + server = WebSocketProxy(**params) + server.start_server() + + proc = Process(target=start_proxy) + proc.start() + return proc + + +def add_proxy_token(name, port): + with open(os.path.join(WS_TOKENS_DIR, name), 'w') as f: + """ + From python documentation base64.urlsafe_b64encode(s) + substitutes - instead of + and _ instead of / in the + standard Base64 alphabet, BUT the result can still + contain = which is not safe in a URL query component. + So remove it when needed as base64 can work well without it. + """ + name = base64.urlsafe_b64encode(name).rstrip('=') + f.write('%s: localhost:%s' % (name.encode('utf-8'), port)) + + +def remove_proxy_token(name): + try: + os.unlink(os.path.join(WS_TOKENS_DIR, name)) + except OSError: + pass diff --git a/src/wok/vnc.py b/src/wok/vnc.py deleted file mode 100644 index 2532449..0000000 --- a/src/wok/vnc.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python2 -# -# Project Kimchi -# -# Copyright IBM, Corp. 2013-2015 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -import base64 -import errno -import os -from multiprocessing import Process -from websockify import WebSocketProxy - -from wok.config import config, paths - - -WS_TOKENS_DIR = '/var/lib/wok/vnc-tokens' - - -def new_ws_proxy(): - try: - os.makedirs(WS_TOKENS_DIR, mode=0755) - except OSError as e: - if e.errno == errno.EEXIST: - pass - - cert = config.get('server', 'ssl_cert') - key = config.get('server', 'ssl_key') - if not (cert and key): - cert = '%s/wok-cert.pem' % paths.conf_dir - key = '%s/wok-key.pem' % paths.conf_dir - - params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'), - 'listen_port': config.get('display', 'display_proxy_port'), - 'target_cfg': WS_TOKENS_DIR, - 'key': key, 'cert': cert, 'ssl_only': True} - - def start_proxy(): - server = WebSocketProxy(**params) - server.start_server() - - proc = Process(target=start_proxy) - proc.start() - return proc - - -def add_proxy_token(name, port): - with open(os.path.join(WS_TOKENS_DIR, name), 'w') as f: - """ - From python documentation base64.urlsafe_b64encode(s) - substitutes - instead of + and _ instead of / in the - standard Base64 alphabet, BUT the result can still - contain = which is not safe in a URL query component. - So remove it when needed as base64 can work well without it. - """ - name = base64.urlsafe_b64encode(name).rstrip('=') - f.write('%s: localhost:%s' % (name.encode('utf-8'), port)) - - -def remove_proxy_token(name): - try: - os.unlink(os.path.join(WS_TOKENS_DIR, name)) - except OSError: - pass

python-imaging, websockify, novnc and spice-html5 packages are only needed by Kimchi. So remove them from Wok. python-cherrypy, python-cheetah, m2crypto, PyPAM, nginx and python-ldap packages are only needed by wok. So remove them from Kimchi. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- contrib/DEBIAN/control.in | 4 ---- contrib/wok.spec.fedora.in | 11 ----------- contrib/wok.spec.suse.in | 4 ---- plugins/kimchi/contrib/DEBIAN/control.in | 6 ------ plugins/kimchi/contrib/kimchi.spec.fedora.in | 6 ------ plugins/kimchi/contrib/kimchi.spec.suse.in | 6 ------ 6 files changed, 37 deletions(-) diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in index ef4e0c2..fd148fb 100644 --- a/contrib/DEBIAN/control.in +++ b/contrib/DEBIAN/control.in @@ -5,9 +5,6 @@ Priority: optional Architecture: all Depends: python-cherrypy3 (>= 3.2.0), python-cheetah, - python-imaging, - websockify, - novnc, python-jsonschema (>= 1.3.0), gettext, python-m2crypto, @@ -15,7 +12,6 @@ Depends: python-cherrypy3 (>= 3.2.0), python-lxml, nginx, python-ldap, - spice-html5 Build-Depends: libxslt, openssl, python-lxml diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in index 037e705..eb7fcb2 100644 --- a/contrib/wok.spec.fedora.in +++ b/contrib/wok.spec.fedora.in @@ -10,10 +10,7 @@ Source0: %{name}-%{version}.tar.gz Requires: gettext Requires: python-cherrypy >= 3.2.0 Requires: python-cheetah -Requires: python-websockify -Requires: novnc Requires: m2crypto -Requires: python-imaging Requires: PyPAM Requires: python-jsonschema >= 1.3.0 Requires: python-lxml @@ -23,10 +20,6 @@ BuildRequires: libxslt BuildRequires: openssl BuildRequires: python-lxml -%if 0%{?rhel} >= 6 || 0%{?fedora} >= 19 -Requires: spice-html5 -%endif - %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 %global with_systemd 1 %endif @@ -58,11 +51,7 @@ Wok is Webserver Originated from Kimchi. %build -%if 0%{?rhel} >= 6 || 0%{?fedora} >= 19 %configure -%else -%configure --with-spice-html5 -%endif make diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in index 6bff10a..b55fcf1 100644 --- a/contrib/wok.spec.suse.in +++ b/contrib/wok.spec.suse.in @@ -10,9 +10,6 @@ Source0: %{name}-%{version}.tar.gz Requires: gettext-tools Requires: python-CherryPy >= 3.2.0 Requires: python-Cheetah -Requires: python-websockify -Requires: novnc -Requires: python-imaging Requires: python-M2Crypto Requires: python-pam Requires: python-jsonschema >= 1.3.0 @@ -39,7 +36,6 @@ Wok is Webserver Originated from Kimchi. %setup %build -%configure --with-spice-html5 make %install diff --git a/plugins/kimchi/contrib/DEBIAN/control.in b/plugins/kimchi/contrib/DEBIAN/control.in index ecfcd89..dc153d8 100644 --- a/plugins/kimchi/contrib/DEBIAN/control.in +++ b/plugins/kimchi/contrib/DEBIAN/control.in @@ -4,8 +4,6 @@ Section: base Priority: optional Architecture: all Depends: wok, - python-cherrypy3 (>= 3.2.0), - python-cheetah, python-imaging, python-configobj, websockify, @@ -15,9 +13,7 @@ Depends: wok, gettext, libvirt-bin, nfs-common, - python-m2crypto, qemu-kvm, - python-pam, python-parted, python-psutil (>= 0.6.0), python-ethtool, @@ -25,9 +21,7 @@ Depends: wok, python-ipaddr, python-lxml, open-iscsi, - nginx, python-guestfs, - python-ldap, libguestfs-tools, spice-html5 Build-Depends: libxslt, diff --git a/plugins/kimchi/contrib/kimchi.spec.fedora.in b/plugins/kimchi/contrib/kimchi.spec.fedora.in index fa53980..0db3d7e 100644 --- a/plugins/kimchi/contrib/kimchi.spec.fedora.in +++ b/plugins/kimchi/contrib/kimchi.spec.fedora.in @@ -13,14 +13,10 @@ Requires: gettext Requires: libvirt Requires: libvirt-python Requires: libvirt-daemon-config-network -Requires: python-cherrypy >= 3.2.0 -Requires: python-cheetah Requires: python-websockify Requires: python-configobj Requires: novnc -Requires: m2crypto Requires: python-imaging -Requires: PyPAM Requires: pyparted Requires: python-psutil >= 0.6.0 Requires: python-jsonschema >= 1.3.0 @@ -29,9 +25,7 @@ Requires: sos Requires: python-ipaddr Requires: python-lxml Requires: nfs-utils -Requires: nginx Requires: iscsi-initiator-utils -Requires: python-ldap Requires: python-libguestfs Requires: libguestfs-tools BuildRequires: libxslt diff --git a/plugins/kimchi/contrib/kimchi.spec.suse.in b/plugins/kimchi/contrib/kimchi.spec.suse.in index 9b55c7b..e466961 100644 --- a/plugins/kimchi/contrib/kimchi.spec.suse.in +++ b/plugins/kimchi/contrib/kimchi.spec.suse.in @@ -13,24 +13,18 @@ Requires: gettext-tools Requires: libvirt Requires: libvirt-python Requires: libvirt-daemon-config-network -Requires: python-CherryPy >= 3.2.0 -Requires: python-Cheetah Requires: python-websockify Requires: python-configobj Requires: novnc Requires: python-imaging -Requires: python-M2Crypto -Requires: python-pam Requires: python-parted Requires: python-psutil >= 0.6.0 Requires: python-jsonschema >= 1.3.0 Requires: python-ethtool Requires: python-ipaddr -Requires: python-ldap Requires: python-lxml Requires: python-xml Requires: nfs-client -Requires: nginx Requires: open-iscsi Requires: python-libguestfs Requires: guestfs-tools -- 2.1.0

Reviewed-By: Paulo Vital <pvital@linux.vnet.ibm.com> On Wed, 2015-09-16 at 14:44 -0300, Aline Manera wrote:
python-imaging, websockify, novnc and spice-html5 packages are only needed by Kimchi. So remove them from Wok.
python-cherrypy, python-cheetah, m2crypto, PyPAM, nginx and python -ldap packages are only needed by wok. So remove them from Kimchi.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- contrib/DEBIAN/control.in | 4 ---- contrib/wok.spec.fedora.in | 11 ----------- contrib/wok.spec.suse.in | 4 ---- plugins/kimchi/contrib/DEBIAN/control.in | 6 ------ plugins/kimchi/contrib/kimchi.spec.fedora.in | 6 ------ plugins/kimchi/contrib/kimchi.spec.suse.in | 6 ------ 6 files changed, 37 deletions(-)
diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in index ef4e0c2..fd148fb 100644 --- a/contrib/DEBIAN/control.in +++ b/contrib/DEBIAN/control.in @@ -5,9 +5,6 @@ Priority: optional Architecture: all Depends: python-cherrypy3 (>= 3.2.0), python-cheetah, - python-imaging, - websockify, - novnc, python-jsonschema (>= 1.3.0), gettext, python-m2crypto, @@ -15,7 +12,6 @@ Depends: python-cherrypy3 (>= 3.2.0), python-lxml, nginx, python-ldap, - spice-html5 Build-Depends: libxslt, openssl, python-lxml diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in index 037e705..eb7fcb2 100644 --- a/contrib/wok.spec.fedora.in +++ b/contrib/wok.spec.fedora.in @@ -10,10 +10,7 @@ Source0: %{name}-%{version}.tar.gz Requires: gettext Requires: python-cherrypy >= 3.2.0 Requires: python-cheetah -Requires: python-websockify -Requires: novnc Requires: m2crypto -Requires: python-imaging Requires: PyPAM Requires: python-jsonschema >= 1.3.0 Requires: python-lxml @@ -23,10 +20,6 @@ BuildRequires: libxslt BuildRequires: openssl BuildRequires: python-lxml
-%if 0%{?rhel} >= 6 || 0%{?fedora} >= 19 -Requires: spice-html5 -%endif - %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 %global with_systemd 1 %endif @@ -58,11 +51,7 @@ Wok is Webserver Originated from Kimchi.
%build -%if 0%{?rhel} >= 6 || 0%{?fedora} >= 19 %configure -%else -%configure --with-spice-html5 -%endif make
diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in index 6bff10a..b55fcf1 100644 --- a/contrib/wok.spec.suse.in +++ b/contrib/wok.spec.suse.in @@ -10,9 +10,6 @@ Source0: %{name}-%{version}.tar.gz Requires: gettext-tools Requires: python-CherryPy >= 3.2.0 Requires: python-Cheetah -Requires: python-websockify -Requires: novnc -Requires: python-imaging Requires: python-M2Crypto Requires: python-pam Requires: python-jsonschema >= 1.3.0 @@ -39,7 +36,6 @@ Wok is Webserver Originated from Kimchi. %setup
%build -%configure --with-spice-html5 make
%install diff --git a/plugins/kimchi/contrib/DEBIAN/control.in b/plugins/kimchi/contrib/DEBIAN/control.in index ecfcd89..dc153d8 100644 --- a/plugins/kimchi/contrib/DEBIAN/control.in +++ b/plugins/kimchi/contrib/DEBIAN/control.in @@ -4,8 +4,6 @@ Section: base Priority: optional Architecture: all Depends: wok, - python-cherrypy3 (>= 3.2.0), - python-cheetah, python-imaging, python-configobj, websockify, @@ -15,9 +13,7 @@ Depends: wok, gettext, libvirt-bin, nfs-common, - python-m2crypto, qemu-kvm, - python-pam, python-parted, python-psutil (>= 0.6.0), python-ethtool, @@ -25,9 +21,7 @@ Depends: wok, python-ipaddr, python-lxml, open-iscsi, - nginx, python-guestfs, - python-ldap, libguestfs-tools, spice-html5 Build-Depends: libxslt, diff --git a/plugins/kimchi/contrib/kimchi.spec.fedora.in b/plugins/kimchi/contrib/kimchi.spec.fedora.in index fa53980..0db3d7e 100644 --- a/plugins/kimchi/contrib/kimchi.spec.fedora.in +++ b/plugins/kimchi/contrib/kimchi.spec.fedora.in @@ -13,14 +13,10 @@ Requires: gettext Requires: libvirt Requires: libvirt-python Requires: libvirt-daemon-config-network -Requires: python-cherrypy >= 3.2.0 -Requires: python-cheetah Requires: python-websockify Requires: python-configobj Requires: novnc -Requires: m2crypto Requires: python-imaging -Requires: PyPAM Requires: pyparted Requires: python-psutil >= 0.6.0 Requires: python-jsonschema >= 1.3.0 @@ -29,9 +25,7 @@ Requires: sos Requires: python-ipaddr Requires: python-lxml Requires: nfs-utils -Requires: nginx Requires: iscsi-initiator-utils -Requires: python-ldap Requires: python-libguestfs Requires: libguestfs-tools BuildRequires: libxslt diff --git a/plugins/kimchi/contrib/kimchi.spec.suse.in b/plugins/kimchi/contrib/kimchi.spec.suse.in index 9b55c7b..e466961 100644 --- a/plugins/kimchi/contrib/kimchi.spec.suse.in +++ b/plugins/kimchi/contrib/kimchi.spec.suse.in @@ -13,24 +13,18 @@ Requires: gettext-tools Requires: libvirt Requires: libvirt-python Requires: libvirt-daemon-config-network -Requires: python-CherryPy >= 3.2.0 -Requires: python-Cheetah Requires: python-websockify Requires: python-configobj Requires: novnc Requires: python-imaging -Requires: python-M2Crypto -Requires: python-pam Requires: python-parted Requires: python-psutil >= 0.6.0 Requires: python-jsonschema >= 1.3.0 Requires: python-ethtool Requires: python-ipaddr -Requires: python-ldap Requires: python-lxml Requires: python-xml Requires: nfs-client -Requires: nginx Requires: open-iscsi Requires: python-libguestfs Requires: guestfs-tools
participants (2)
-
Aline Manera
-
Paulo Ricardo Paz Vital