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 <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456956
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Karol Latecki 2019-06-05 11:05:39 +02:00 committed by Darek Stojaczyk
parent 77509767c0
commit 535654f826

View File

@ -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()