upstream/openstack/openstack-aodh/centos/patches/0001-modify-aodh-api.patch
Hayde Martinez 748f79bce2 upgrade openstack-aodh to CentOS 7.5 version
Story: 2003389
Task: 24484

Change-Id: Ib28868c38da6264ca3b05bef6aa5ad7d9b372cf5
Signed-off-by: Hayde Martinez <hayde.martinez.landa@intel.com>
2018-09-09 07:02:52 +08:00

62 lines
1.8 KiB
Diff

From 4307eaa7d2cf3dbcf1eb25c7b2636aeaef13b6c7 Mon Sep 17 00:00:00 2001
From: Angie Wang <angie.Wang@windriver.com>
Date: Wed, 15 Feb 2017 15:59:26 -0500
Subject: [PATCH 1/2] modify-aodh-api
---
aodh/api/aodh-api.py | 7 +++++++
aodh/api/app.py | 12 +++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
create mode 100644 aodh/api/aodh-api.py
diff --git a/aodh/api/aodh-api.py b/aodh/api/aodh-api.py
new file mode 100644
index 0000000..565f2e3
--- /dev/null
+++ b/aodh/api/aodh-api.py
@@ -0,0 +1,7 @@
+from aodh.api import app as build_wsgi_app
+import sys
+
+sys.argv = sys.argv[:1]
+args = {'config_file' : 'etc/aodh/aodh.conf', }
+application = build_wsgi_app.build_wsgi_app(None, args)
+
diff --git a/aodh/api/app.py b/aodh/api/app.py
index b7c0900..ba0a438 100644
--- a/aodh/api/app.py
+++ b/aodh/api/app.py
@@ -53,7 +53,7 @@ def setup_app(root, conf):
)
-def load_app(conf):
+def load_app(conf, args):
global APPCONFIGS
# Build the WSGI app
@@ -64,6 +64,12 @@ def load_app(conf):
if cfg_path is None or not os.path.exists(cfg_path):
raise cfg.ConfigFilesNotFoundError([conf.api.paste_config])
+ config = dict([(key, value) for key, value in args.iteritems()
+ if key in conf and value is not None])
+ for key, value in config.iteritems():
+ if key == 'config_file':
+ conf.config_file = value
+
config = dict(conf=conf)
configkey = str(uuid.uuid4())
APPCONFIGS[configkey] = config
@@ -83,5 +89,5 @@ def app_factory(global_config, **local_conf):
return setup_app(root=local_conf.get('root'), **appconfig)
-def build_wsgi_app(argv=None):
- return load_app(service.prepare_service(argv=argv))
+def build_wsgi_app(argv=None, args=None):
+ return load_app(service.prepare_service(argv=argv), args)
--
2.7.4