From f1a71b2889da3b49358b10b9a12ea5a512dd2743 Mon Sep 17 00:00:00 2001 From: rexlee8776 Date: Wed, 9 May 2018 09:52:27 +0000 Subject: Bugfix: openrc api dump should be safe_dump 1. fix safe_dump 2. fix pep8 problem, use flask_restapi custom error handling [1] [1] https://flask-restful.readthedocs.io/en/latest/extending.html#custom-error-handlers JIRA: YARDSTICK-1165 RestApi openrc dump clouds.yaml error it now use yarml.dump, should be yaml.safe_dump. dump would gererate !!python/unicode and cause error when upload openrc file in gui Change-Id: Id3e85f7ba7d4967277ef79109b07d7552179e5db Signed-off-by: rexlee8776 --- api/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'api/server.py') diff --git a/api/server.py b/api/server.py index 37a1ab6a6..914fe8457 100644 --- a/api/server.py +++ b/api/server.py @@ -39,11 +39,13 @@ app.config['MAX_CONTENT_LENGTH'] = 2 * 1024 * 1024 * 1024 Swagger(app) -api = Api(app) +api = Api(app, errors=consts.API_ERRORS) @app.teardown_request def shutdown_session(exception=None): + if exception: + LOG.warning(exception.message) db_session.remove() -- cgit 1.2.3-korg