[Kimchi-devel] [PATCH 1/2] Add novnc as Kimchi dependency

Aline Manera alinefm at linux.vnet.ibm.com
Mon Oct 6 19:09:58 UTC 2014


novnc is present in all supported Linux distributions (RHEL6.5,
RHEL7, Fedora20, Ubuntu 14.04 and openSUSE 13.1) so instead of importing
its code into Kimchi source source structure we must add its package as
a Kimchi dependency and use it as is.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 contrib/DEBIAN/control.in        |  1 +
 contrib/kimchi.spec.fedora.in    |  1 +
 contrib/kimchi.spec.suse.in      |  1 +
 docs/README.md                   |  7 ++++---
 src/kimchi/Makefile.am           |  1 +
 src/kimchi/config.py.in          | 14 +++++++++++++-
 tests/Makefile.am                |  1 +
 tests/test_config.py.in          | 14 +++++++++++++-
 ui/js/src/kimchi.api.js          |  3 ++-
 ui/pages/websockify/console.html |  2 +-
 10 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index 99546fa..96f077b 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -6,6 +6,7 @@ Architecture: all
 Depends: python-cherrypy3 (>= 3.2.0),
          python-cheetah,
          python-imaging,
+         novnc,
          python-jsonschema (>= 1.3.0),
          python-libvirt,
          gettext,
diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
index 4327376..9c0b0b7 100644
--- a/contrib/kimchi.spec.fedora.in
+++ b/contrib/kimchi.spec.fedora.in
@@ -12,6 +12,7 @@ Requires:	libvirt
 Requires:	libvirt-python
 Requires:	python-cherrypy >= 3.2.0
 Requires:	python-cheetah
+Requires:	novnc
 Requires:	m2crypto
 Requires:	python-imaging
 Requires:	libxml2-python
diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
index 4386d2d..590ba89 100644
--- a/contrib/kimchi.spec.suse.in
+++ b/contrib/kimchi.spec.suse.in
@@ -12,6 +12,7 @@ Requires:	libvirt
 Requires:	libvirt-python
 Requires:	python-CherryPy >= 3.2.0
 Requires:	python-Cheetah
+Requires:	novnc
 Requires:	python-imaging
 Requires:	python-M2Crypto
 Requires:	python-libxml2
diff --git a/docs/README.md b/docs/README.md
index 19e8a68..177ecc2 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -55,7 +55,7 @@ Install Dependencies
                         python-ipaddr python-lxml nfs-utils \
                         iscsi-initiator-utils libxslt pyparted nginx \
                         policycoreutils-python python-libguestfs \
-                        libguestfs-tools python-requests
+                        libguestfs-tools python-requests novnc
      # If using RHEL6, install the following additional packages:
      $ sudo yum install python-unittest2 python-ordereddict
      # Restart libvirt to allow configuration changes to take effect
@@ -79,7 +79,7 @@ for more information on how to configure your system to access this repository.
                            sosreport python-ipaddr python-lxml nfs-common \
                            open-iscsi lvm2 xsltproc python-parted nginx \
                            firewalld python-guestfs libguestfs-tools \
-                           python-requests
+                           python-requests novnc
 
     Packages version requirement:
         python-jsonschema >= 1.3.0
@@ -94,7 +94,8 @@ for more information on how to configure your system to access this repository.
                           rpm-build kvm python-psutil python-ethtool \
                           python-ipaddr python-lxml nfs-client open-iscsi \
                           libxslt-tools python-xml python-parted nginx \
-                          python-libguestfs guestfs-tools python-requests
+                          python-libguestfs guestfs-tools python-requests \
+                          novnc
 
     Packages version requirement:
         python-psutil >= 0.6.0
diff --git a/src/kimchi/Makefile.am b/src/kimchi/Makefile.am
index e2b5bea..e2b5de8 100644
--- a/src/kimchi/Makefile.am
+++ b/src/kimchi/Makefile.am
@@ -38,6 +38,7 @@ uninstall-local:
 
 do_substitution = \
 	sed -e 's,[@]prefix[@],$(prefix),g'             \
+	-e 's,[@]datadir[@],$(datadir),g'         \
 	-e 's,[@]sysconfdir[@],$(sysconfdir),g'         \
 	-e 's,[@]localstatedir[@],$(localstatedir),g'   \
 	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'         \
diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index 91e5f48..144ae8a 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -185,9 +185,21 @@ class KimchiConfig(dict):
             'tools.sessions.timeout': SESSIONSTIMEOUT,
             'tools.kimchiauth.on': False
         },
-        '/vnc_auto.html': {
+        '/novnc/vnc_auto.html': {
+            'tools.staticfile.on': True,
+            'tools.staticfile.filename': '@datadir@/novnc/vnc_auto.html',
             'tools.kimchiauth.on': True
         },
+        '/novnc/images': {
+            'tools.staticdir.on': True,
+            'tools.staticdir.dir': '@datadir@/novnc/images',
+            'tools.nocache.on': False
+        },
+        '/novnc/include': {
+            'tools.staticdir.on': True,
+            'tools.staticdir.dir': '@datadir@/novnc/include',
+            'tools.nocache.on': False
+        },
         '/spice.html': {
             'tools.kimchiauth.on': True
         },
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f5294e..09dce6c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,7 @@ noinst_SCRIPTS = run_tests.sh
 do_substitution = \
 	sed -e 's,[@]HAVE_PYMOD_UNITTEST[@],$(HAVE_PYMOD_UNITTEST),g' \
 	-e 's,[@]prefix[@],$(prefix),g' \
+	-e 's,[@]datadir[@],$(datadir),g' \
 	-e 's,[@]PYTHON_VERSION[@],$(PYTHON_VERSION),g' \
 	-e 's,[@]kimchidir[@],$(pythondir)/kimchi,g' \
 	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
diff --git a/tests/test_config.py.in b/tests/test_config.py.in
index f5bbd39..a9d69a9 100644
--- a/tests/test_config.py.in
+++ b/tests/test_config.py.in
@@ -106,9 +106,21 @@ class ConfigTests(unittest.TestCase):
                 'tools.sessions.timeout': SESSIONSTIMEOUT,
                 'tools.kimchiauth.on': False
             },
-            '/vnc_auto.html': {
+            '/novnc/vnc_auto.html': {
+                'tools.staticfile.on': True,
+                'tools.staticfile.filename': '@datadir@/novnc/vnc_auto.html',
                 'tools.kimchiauth.on': True
             },
+            '/novnc/images': {
+                'tools.staticdir.on': True,
+                'tools.staticdir.dir': '@datadir@/novnc/images',
+                'tools.nocache.on': False
+            },
+            '/novnc/include': {
+                'tools.staticdir.on': True,
+                'tools.staticdir.dir': '@datadir@/novnc/include',
+                'tools.nocache.on': False
+            },
             '/spice.html': {
                 'tools.kimchiauth.on': True
             },
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 3398bd4..f0506fa 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -353,7 +353,8 @@ var kimchi = {
                 dataType : "json"
             }).done(function() {
                 url = 'https://' + location.hostname + ':' + proxy_port;
-                url += "/console.html?url=vnc_auto.html&port=" + proxy_port;
+                url += "/console.html?url=" + encodeURIComponent("novnc/vnc_auto.html");
+                url += "&port=" + proxy_port;
                 /*
                  * From python documentation base64.urlsafe_b64encode(s)
                  * substitutes - instead of + and _ instead of / in the
diff --git a/ui/pages/websockify/console.html b/ui/pages/websockify/console.html
index a536e38..3be317f 100644
--- a/ui/pages/websockify/console.html
+++ b/ui/pages/websockify/console.html
@@ -14,7 +14,7 @@
         query = query.replace("kimchi=" + kimchi_port, "")
 
         var url = "https://" + location.hostname + ":" + kimchi_port + "/";
-        url += path + query
+        url += decodeURIComponent(path) + query
 
         window.location.replace(url)
       }
-- 
1.9.3




More information about the Kimchi-devel mailing list