[PATCH] [Kimchi] Add server arch from /host API instead of relying on Ginger Base

That is one more change related to remove Ginger Base dependency from Kimchi. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- control/host.py | 6 +++++- ui/js/src/kimchi.api.js | 6 +++--- ui/js/src/kimchi.main.js | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/control/host.py b/control/host.py index b1204fe..7872895 100644 --- a/control/host.py +++ b/control/host.py @@ -17,6 +17,8 @@ # 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 platform + from wok.control.base import Collection from wok.control.base import Resource, SimpleCollection from wok.control.utils import UrlSubNode @@ -25,6 +27,8 @@ from wok.exception import NotFoundError from wok.plugins.kimchi.control.cpuinfo import CPUInfo from wok.plugins.kimchi.utils import is_s390x +ARCH = platform.machine() + @UrlSubNode('host', True) class Host(Resource): @@ -39,7 +43,7 @@ class Host(Resource): @property def data(self): - return {} + return {'arch': ARCH} class VolumeGroups(Collection): diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 1cb89c0..618d68b 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2013-2016 + * Copyright IBM Corp, 2013-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1314,9 +1314,9 @@ var kimchi = { * Get the host information. */ - kimchi.getHostDetails = function(suc, err) { + kimchi.serverConfig = function(suc, err) { wok.requestJSON({ - url: 'plugins/gingerbase/host', + url: 'plugins/kimchi/host', type: 'GET', resend: true, contentType: 'application/json', diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index f3078ec..47531ae 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2013-2016 + * Copyright IBM Corp, 2013-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,8 @@ kimchi.getCapabilities(function(result) { }); kimchi.hostarch = undefined; -kimchi.getHostDetails(function(result) { - kimchi.hostarch = result["architecture"]; +kimchi.serverConfig(function(result) { + kimchi.hostarch = result["arch"]; }); $(function(){ -- 2.9.3

Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> On 04/26/2017 03:40 PM, Aline Manera wrote:
That is one more change related to remove Ginger Base dependency from Kimchi.
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- control/host.py | 6 +++++- ui/js/src/kimchi.api.js | 6 +++--- ui/js/src/kimchi.main.js | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/control/host.py b/control/host.py index b1204fe..7872895 100644 --- a/control/host.py +++ b/control/host.py @@ -17,6 +17,8 @@ # 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 platform + from wok.control.base import Collection from wok.control.base import Resource, SimpleCollection from wok.control.utils import UrlSubNode @@ -25,6 +27,8 @@ from wok.exception import NotFoundError from wok.plugins.kimchi.control.cpuinfo import CPUInfo from wok.plugins.kimchi.utils import is_s390x
+ARCH = platform.machine() +
@UrlSubNode('host', True) class Host(Resource): @@ -39,7 +43,7 @@ class Host(Resource):
@property def data(self): - return {} + return {'arch': ARCH}
class VolumeGroups(Collection): diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 1cb89c0..618d68b 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2013-2016 + * Copyright IBM Corp, 2013-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1314,9 +1314,9 @@ var kimchi = { * Get the host information. */
- kimchi.getHostDetails = function(suc, err) { + kimchi.serverConfig = function(suc, err) { wok.requestJSON({ - url: 'plugins/gingerbase/host', + url: 'plugins/kimchi/host', type: 'GET', resend: true, contentType: 'application/json', diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index f3078ec..47531ae 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2013-2016 + * Copyright IBM Corp, 2013-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,8 @@ kimchi.getCapabilities(function(result) { });
kimchi.hostarch = undefined; -kimchi.getHostDetails(function(result) { - kimchi.hostarch = result["architecture"]; +kimchi.serverConfig(function(result) { + kimchi.hostarch = result["arch"]; });
$(function(){
participants (2)
-
Aline Manera
-
Daniel Henrique Barboza