From nobody Sat Apr 20 11:08:39 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 1486492485151252.1320283353814; Tue, 7 Feb 2017 10:34:45 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 2A9998205C2; Tue, 7 Feb 2017 18:34:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 35F5B82040C for ; Tue, 7 Feb 2017 18:34:20 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17ISq0R064324 for ; Tue, 7 Feb 2017 13:34:19 -0500 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 28fgmt1b80-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 13:34:19 -0500 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 16:34:17 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 16:34:16 -0200 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id A60281DC0054 for ; Tue, 7 Feb 2017 13:34:16 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17IYFVM4739140 for ; Tue, 7 Feb 2017 16:34:15 -0200 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v17IYFZF001698 for ; Tue, 7 Feb 2017 16:34:15 -0200 Received: from alinefm-TP440.ibmmodules.com ([9.85.187.18]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v17IY8Mp001507 for ; Tue, 7 Feb 2017 16:34:12 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Tue, 7 Feb 2017 16:34:04 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207183405.5444-1-alinefm@linux.vnet.ibm.com> References: <20170207183405.5444-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020718-0020-0000-0000-00000284E678 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020718-0021-0000-0000-0000309F0750 Message-Id: <20170207183405.5444-2-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=9 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702070175 Subject: [Kimchi-devel] [PATCH] [Wok 1/2] Bug fix: Set application options globally on Server() instead of wokd command 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" wokd is a command line tool which relies on Server() instance to start up the web server. To run tests, the wokd command is not used. Instead of that, the Server() instance handles the application options. So instead of setting the options globally on wokd command, do that on Server() to make it used overwhere. This bug was introcuded by 713fd5caa and noticed while running Kimchi tests. Signed-off-by: Aline Manera Reviewed-By: Lucio Correia --- src/wok/server.py | 7 +++++++ src/wokd.in | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wok/server.py b/src/wok/server.py index 9b49c1a..f64a6a2 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -61,6 +61,13 @@ def set_no_cache(): =20 class Server(object): def __init__(self, options): + # Update config.config with the command line values + # So the whole application will have access to accurate values + for sec in config.config.sections(): + for item in config.config.options(sec): + if hasattr(options, item): + config.config.set(sec, item, str(getattr(options, item= ))) + # Check proxy configuration check_proxy_config() =20 diff --git a/src/wokd.in b/src/wokd.in index b701f34..29586a0 100644 --- a/src/wokd.in +++ b/src/wokd.in @@ -78,13 +78,6 @@ def main(options): setattr(options, 'access_log', os.path.join(options.log_dir, ACCESS_LO= G)) setattr(options, 'error_log', os.path.join(options.log_dir, ERROR_LOG)) =20 - # Update config.config with the command line values - # So the whole application will have access to accurate values - for sec in config.config.sections(): - for item in config.config.options(sec): - if hasattr(options, item): - config.config.set(sec, item, str(getattr(options, item))) - # Add non-option arguments setattr(options, 'max_body_size', config.config.get('server', 'max_body_size')) --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 11:08:39 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 1486492496660593.9166368667836; Tue, 7 Feb 2017 10:34:56 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 5A0D6820590; Tue, 7 Feb 2017 18:34:55 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 6C03B82040C for ; Tue, 7 Feb 2017 18:34:24 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17IT8NE082660 for ; Tue, 7 Feb 2017 13:34:23 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 28fkc30kmu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 13:34:23 -0500 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 16:34:21 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 16:34:19 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.18.232.42]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id C8D4B352005F for ; Tue, 7 Feb 2017 13:33:45 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17IYIGa32374956 for ; Tue, 7 Feb 2017 16:34:18 -0200 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v17IYIgD001749 for ; Tue, 7 Feb 2017 16:34:18 -0200 Received: from alinefm-TP440.ibmmodules.com ([9.85.187.18]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v17IY8Mq001507 for ; Tue, 7 Feb 2017 16:34:17 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Tue, 7 Feb 2017 16:34:05 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207183405.5444-1-alinefm@linux.vnet.ibm.com> References: <20170207183405.5444-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020718-0028-0000-0000-00000192FDA4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020718-0029-0000-0000-0000148F2CB7 Message-Id: <20170207183405.5444-3-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_10:, , 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-1612050000 definitions=main-1702070175 Subject: [Kimchi-devel] [PATCH] [Wok 2/2] Bug fix: Do not allow specifying model instance directly to Server() 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" The model instance represents which logic will be set for each REST API available in the server configuration. It was there for testing matters and wrongly used in the plugins tests as it has been using to set the plugin model instance for Wok APIs (?) To avoid problems, remove that capability. Also updates run_server() to remove the model parameter. Signed-off-by: Aline Manera Reviewed-By: Lucio Correia --- src/wok/server.py | 9 ++------- tests/utils.py | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/wok/server.py b/src/wok/server.py index f64a6a2..d99b91f 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -146,19 +146,14 @@ class Server(object): if not dev_env: cherrypy.config.update({'environment': 'production'}) =20 - if hasattr(options, 'model'): - model_instance =3D options.model - else: - model_instance =3D model.Model() - for ident, node in sub_nodes.items(): if node.url_auth: cfg =3D self.configObj ident =3D "/%s" % ident cfg[ident] =3D {'tools.wokauth.on': True} =20 - self.app =3D cherrypy.tree.mount(WokRoot(model_instance, dev_env), - options.server_root, self.configObj) + cherrypy.tree.mount(WokRoot(model.Model(), dev_env), + options.server_root, self.configObj) =20 self._load_plugins() cherrypy.lib.sessions.init() diff --git a/tests/utils.py b/tests/utils.py index 739434f..9c18637 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -88,7 +88,7 @@ if sys.version_info[:2] =3D=3D (2, 6): unittest.TestCase.assertNotIn =3D assertNotIn =20 =20 -def run_server(test_mode, model=3DNone, environment=3D'dev', server_root= =3D''): +def run_server(test_mode, environment=3D'dev', server_root=3D''): =20 args =3D type('_', (object,), {'cherrypy_port': 8010, 'max_body_size': '4*1024', @@ -97,9 +97,6 @@ def run_server(test_mode, model=3DNone, environment=3D'de= v', server_root=3D''): 'log_level': 'debug', 'session_timeout': 10, 'server_root': server_root})() =20 - if model is not None: - setattr(args, 'model', model) - s =3D wok.server.Server(args) t =3D threading.Thread(target=3Ds.start) t.setDaemon(True) --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel