From 7af1a72a24353563452652881b64f5ac805d81c5 Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Thu, 18 Aug 2016 17:20:14 +1200 Subject: [PATCH] Move args parsing to make_app() So that make_app() function can be used for getting wsgi app. Change-Id: I127e045163912ebd0f3643402ac7fec0f38ec0d6 --- distil/api/app.py | 5 +++-- distil/cmd/distil_api.py | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/distil/api/app.py b/distil/api/app.py index 9f75069..c62d5bb 100644 --- a/distil/api/app.py +++ b/distil/api/app.py @@ -12,7 +12,6 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. - import flask from oslo_config import cfg @@ -24,7 +23,9 @@ from distil.utils import api CONF = cfg.CONF -def make_app(): +def make_app(args=None): + config.parse_args(args, 'distil-api') + app = flask.Flask(__name__) @app.route('/', methods=['GET']) diff --git a/distil/cmd/distil_api.py b/distil/cmd/distil_api.py index afe5e1f..3a5689c 100644 --- a/distil/cmd/distil_api.py +++ b/distil/cmd/distil_api.py @@ -41,9 +41,7 @@ class WritableLogger(object): def main(): - config.parse_args(sys.argv[1:], 'distil-api') - - application = app.make_app() + application = app.make_app(sys.argv[1:]) CONF.log_opt_values(LOG, logging.INFO) try: wsgi.server(eventlet.listen((CONF.host, CONF.port), backlog=500),