Skip to content

Commit 5b29ccf

Browse files
pgurenkoalinefm
authored andcommitted
added with_spice_web_client to config
1 parent 45a4ef5 commit 5b29ccf

File tree

6 files changed

+26
-17
lines changed

6 files changed

+26
-17
lines changed

autogen.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ if [ ! -f "configure" ]; then
2929
fi
3030

3131
if [ "x$1" == "x--system" ]; then
32-
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
32+
shift
33+
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var $@
3334
else
3435
if [ $# -gt 0 ]; then
3536
./configure $@

config.py.in

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def get_kimchi_version():
4242
return "-".join([__version__, __release__])
4343

4444

45+
def with_spice_web_client():
46+
return __with_spice_web_client__ == 'yes'
47+
48+
4549
def get_distros_store():
4650
return os.path.join(kimchiPaths.sysconf_dir, 'distros.d')
4751

@@ -109,6 +113,8 @@ class KimchiPaths(PluginPaths):
109113
'spice-web-client/index.html')
110114
self.spice_dir = os.path.join(self.ui_dir, 'spice-web-client')
111115
else:
116+
self.spice_file = os.path.join(self.ui_dir,
117+
'spice-html5/pages/spice_auto.html')
112118
if __with_spice__ == 'yes':
113119
self.spice_dir = os.path.join(self.ui_dir, 'spice-html5')
114120
elif os.path.exists('@datadir@/spice-html5'):

docs/API.md

+1
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ Contains information about Kimchi configuration.
824824

825825
* **GET**: Retrieve configuration information
826826
* version: The version of the kimchi service
827+
* with_spice_web_client: True is buit with spice web client support
827828
* **POST**: *See Configuration Actions*
828829

829830
**Actions (POST):**

model/config.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from wok.exception import NotFoundError
2424
from wok.plugins.kimchi.config import find_qemu_binary
2525
from wok.plugins.kimchi.config import get_kimchi_version
26+
from wok.plugins.kimchi.config import with_spice_web_client
2627
from wok.plugins.kimchi.distroloader import DistroLoader
2728
from wok.plugins.kimchi.model.featuretests import FEATURETEST_POOL_NAME
2829
from wok.plugins.kimchi.model.featuretests import FEATURETEST_VM_NAME
@@ -39,7 +40,8 @@ def __init__(self, **kargs):
3940
pass
4041

4142
def lookup(self, name):
42-
return {'version': get_kimchi_version()}
43+
return {'version': get_kimchi_version(),
44+
'with_spice_web_client': with_spice_web_client()}
4345

4446

4547
class CapabilitiesModel(object, metaclass=Singleton):

tests/test_rest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ def test_tasks(self):
16831683
def test_config(self):
16841684
resp = self.request('/plugins/kimchi/config').read()
16851685
conf = json.loads(resp)
1686-
keys = ['version']
1686+
keys = ["version", "with_spice_web_client"]
16871687
self.assertEqual(keys, sorted(conf.keys()))
16881688

16891689
def test_capabilities(self):

ui/js/src/kimchi.api.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,20 @@ var kimchi = {
372372
}).done(function(data, textStatus, xhr) {
373373
url = 'https://' + location.hostname + ':' + proxy_port;
374374
url += server_root;
375-
376-
let spice_html5 = true;
377-
if(spice_html5)
375+
if(kimchi.config['with_spice_web_client'])
376+
{
377+
/*
378+
* Slightly different api for spice-web-client
379+
*/
380+
url += "/plugins/kimchi/spice-web-client/index.html";
381+
url += "?port=" + proxy_port + server_root;
382+
url += "&host=" + location.hostname;
383+
url += "&vmInfoToken=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, "");
384+
url += '&protocol=wss';
385+
}
386+
else
378387
{
388+
// Using spice-html5 by default
379389
url += "/plugins/kimchi/spice_auto.html";
380390
/*
381391
* When using server_root we need pass the value with port
@@ -393,17 +403,6 @@ var kimchi = {
393403
url += "&token=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, "");
394404
url += '&encrypt=1';
395405
}
396-
else
397-
{
398-
/*
399-
* Slightly different api for spice-web-client
400-
*/
401-
url += "/plugins/kimchi/spice-web-client/index.html";
402-
url += "?port=" + proxy_port + server_root;
403-
url += "&host=" + location.hostname;
404-
url += "&vmInfoToken=" + wok.urlSafeB64Encode(vm).replace(/=*$/g, "");
405-
url += '&protocol=wss';
406-
}
407406
window.open(url);
408407
});
409408
},

0 commit comments

Comments
 (0)