From a1fee2ca0c20eca9bbd2ae704cf1e6f99450dcd6 Mon Sep 17 00:00:00 2001 From: Qixiang Wan Date: Jul 30 2019 07:47:38 +0000 Subject: client: add quiet option Add new option "-q|--quiet" to client command, the default value is False. This is to hide some log messages and then the output can be parsed more easily. --- diff --git a/client/contrib/odcs b/client/contrib/odcs index b96ed0a..4c8713e 100755 --- a/client/contrib/odcs +++ b/client/contrib/odcs @@ -67,6 +67,9 @@ parser.add_argument( parser.add_argument( '--no-wait', action='store_true', help='When used, odcs client will not wait for the action to finish.') +parser.add_argument( + '-q', '--quiet', action='store_true', + help='Run without detailed log messages') subparsers = parser.add_subparsers( description='These commands you can use to operate composes with ODCS') @@ -234,7 +237,8 @@ except requests.exceptions.HTTPError as e: if args.no_wait: print(json.dumps(result, indent=4, sort_keys=True)) else: - print("Waiting for command %s on compose %d to finish." % - (args.command, result["id"])) + if not args.quiet: + print("Waiting for command %s on compose %d to finish." % + (args.command, result["id"])) result = client.wait_for_compose(result["id"], 3600) print(json.dumps(result, indent=4, sort_keys=True))