From 535654f826fbff8b0393ebcdaf634796a6dd9816 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 5 Jun 2019 11:05:39 +0200 Subject: [PATCH] scripts/rpc: add try-except around call_rpc_func Missing try-except block around call_rpc_func(). If called function returned error there was an uncaught exception which resulted in backtrace printed to screen. Change-Id: Ifb37c29d70b93ef648a0503643a51cc1967ef8d0 Signed-off-by: Karol Latecki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456956 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Darek Stojaczyk --- scripts/rpc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/rpc.py b/scripts/rpc.py index e52eb81ae..09ebca9f6 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -1826,7 +1826,11 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse args = parser.parse_args() args.client = rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout, log_level=getattr(logging, args.verbose.upper())) if hasattr(args, 'func'): - call_rpc_func(args) + try: + call_rpc_func(args) + except JSONRPCException as ex: + print(ex) + exit(1) elif sys.stdin.isatty(): # No arguments and no data piped through stdin parser.print_help()