From nobody Thu Dec 26 13:55:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1493147238609162.5005080539703; Tue, 25 Apr 2017 12:07:18 -0700 (PDT) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 2EEB8820520; Tue, 25 Apr 2017 19:07:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 11D0F820518 for ; Tue, 25 Apr 2017 19:07:00 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3PJ3xIO095454 for ; Tue, 25 Apr 2017 15:07:00 -0400 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a1v5197f1-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 25 Apr 2017 15:07:00 -0400 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Apr 2017 16:06:57 -0300 Received: from d24relay04.br.ibm.com (9.18.232.146) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 25 Apr 2017 16:06:55 -0300 Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3PJ6opW34865300 for ; Tue, 25 Apr 2017 16:06:55 -0300 Received: from d24av02.br.ibm.com (localhost [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v3PJ6ZY7031484 for ; Tue, 25 Apr 2017 16:06:35 -0300 Received: from alinefm-TP440.br.ibm.com (alinefm-TP440.br.ibm.com [9.18.239.173]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v3PJ6Z3P031316 for ; Tue, 25 Apr 2017 16:06:35 -0300 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Tue, 25 Apr 2017 16:06:19 -0300 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17042519-0028-0000-0000-000001AE17CC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042519-0029-0000-0000-000014AE5753 Message-Id: <20170425190619.3472-1-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-25_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704250333 Subject: [Kimchi-devel] [PATCH] [Wok] Add system arch to /config API X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It may be useful when UI differs depending on system arch. It is part of solution to remove Ginger Base dependency from Kimchi. Signed-off-by: Aline Manera Reviewed-by: Daniel Barboza --- docs/API/config.md | 2 ++ src/wok/model/config.py | 4 ++++ tests/test_api.py | 2 +- tests/test_config_model.py | 2 +- tests/test_server_root.py | 6 +++--- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/API/config.md b/docs/API/config.md index d1d1007..b810f2a 100644 --- a/docs/API/config.md +++ b/docs/API/config.md @@ -12,6 +12,8 @@ Contains information about the application environment an= d configuration. * proxy_port: SSL port to list on * websockets_port: Port for websocket proxy to listen on * auth: Authentication method used to log in to Wok + * server_root: Wok root API path + * arch: System architecture * version: Wok version * **POST**: *See Task Actions* =20 diff --git a/src/wok/model/config.py b/src/wok/model/config.py index b69f2dd..54aaf54 100644 --- a/src/wok/model/config.py +++ b/src/wok/model/config.py @@ -18,12 +18,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130= 1 USA =20 import cherrypy +import platform import time =20 from wok.config import config, get_version from wok.model.notifications import add_notification from wok.utils import wok_log =20 +ARCH =3D platform.machine() + =20 class ConfigModel(object): def __init__(self, **kargs): @@ -34,6 +37,7 @@ class ConfigModel(object): 'websockets_port': config.get('server', 'websockets_port'), 'auth': config.get('authentication', 'method'), 'server_root': config.get('server', 'server_root'), + 'arch': ARCH, 'version': get_version()} =20 def reload(self, name): diff --git a/tests/test_api.py b/tests/test_api.py index 6fbee75..4e2e413 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -52,7 +52,7 @@ class APITests(unittest.TestCase): def test_config(self): resp =3D self.request('/config').read() conf =3D json.loads(resp) - keys =3D ["auth", "proxy_port", "websockets_port", "version", + keys =3D ["arch", "auth", "proxy_port", "websockets_port", "versio= n", "server_root"] self.assertEquals(sorted(keys), sorted(conf.keys())) =20 diff --git a/tests/test_config_model.py b/tests/test_config_model.py index f8b0848..df2b058 100644 --- a/tests/test_config_model.py +++ b/tests/test_config_model.py @@ -30,7 +30,7 @@ class ConfigModelTests(unittest.TestCase): config =3D inst.config_lookup('') self.assertItemsEqual( ['proxy_port', 'websockets_port', 'auth', - 'server_root', 'version'], + 'server_root', 'arch', 'version'], config.keys() ) =20 diff --git a/tests/test_server_root.py b/tests/test_server_root.py index e95a13b..89f34d3 100644 --- a/tests/test_server_root.py +++ b/tests/test_server_root.py @@ -1,7 +1,7 @@ # # Project Wok # -# Copyright IBM Corp, 2016 +# Copyright IBM Corp, 2016-2017 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -49,7 +49,7 @@ class ServerRootTests(unittest.TestCase): # check if server_root in config is the same used to start server resp =3D request(server_root + '/config').read() conf =3D json.loads(resp) - self.assertEquals(len(conf), 5) + self.assertEquals(len(conf), 6) =20 def test_development_env(self): """ @@ -61,4 +61,4 @@ class ServerRootTests(unittest.TestCase): # check if server_root in config is the same used to start server resp =3D request(server_root + '/config').read() conf =3D json.loads(resp) - self.assertEquals(len(conf), 5) + self.assertEquals(len(conf), 6) --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel