From f5f89f2ae0121798d1b71c89c356ce218162b94d Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Tue, 25 Jul 2017 17:37:01 +0800 Subject: [PATCH] Move osprofiler help message to the end of output Follow the convention of how osprofiler result is displayed in console. Refer to implementation from nova See https://github.com/openstack/python-novaclient/blob/master/novaclient/shell.py#L873 Change-Id: I946d634413e13e1861631a171ae2a939dbb9faa5 Implements: blueprint osprofiler-support --- vitrageclient/shell.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vitrageclient/shell.py b/vitrageclient/shell.py index 7d16797..cd48163 100644 --- a/vitrageclient/shell.py +++ b/vitrageclient/shell.py @@ -164,9 +164,7 @@ class VitrageShell(app.App): # signature and will skip initialization of osprofiler on the # server side. profiler.init(self.options.profile) - trace_id = profiler.get().get_base_id() - print("To display trace use the command:\n\n" - " osprofiler trace show --html %s " % trace_id) + auth_plugin = loading.load_auth_from_argparse_arguments( self.options) session = loading.load_session_from_argparse_arguments( @@ -242,7 +240,12 @@ def main(args=None): try: if args is None: args = sys.argv[1:] - return VitrageShell().run(args) + result = VitrageShell().run(args) + if profiler and '--profile' in args: + trace_id = profiler.get().get_base_id() + print("To display trace use the command:\n\n" + " osprofiler trace show --html %s " % trace_id) + return result except KeyboardInterrupt: print('... terminating vitrage client', file=sys.stderr) sys.exit(1)