scripts/rpc.py: add call_rpc_func()
This makes no functional change to the script, but
it prepares for an upcoming change allowing callers
to pipe a newline delimited list of rpc calls.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452769 (master)
(cherry picked from commit 6895f0f27e
)
Change-Id: I695ca61510f9edd336713e88d134e42c1d78a1b4
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457219
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
a9085b08c3
commit
02b29614e7
@ -1792,13 +1792,14 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.add_argument('-n', '--max', help="""Maximum number of notifications to return in response""", type=int)
|
||||
p.set_defaults(func=get_notifications)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout, log_level=getattr(logging, args.verbose.upper())) as client:
|
||||
def call_rpc_func(args):
|
||||
try:
|
||||
args.client = client
|
||||
args.func(args)
|
||||
except JSONRPCException as ex:
|
||||
print("Exception:")
|
||||
print(ex.message)
|
||||
exit(1)
|
||||
|
||||
args = parser.parse_args()
|
||||
args.client = rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout, log_level=getattr(logging, args.verbose.upper()))
|
||||
call_rpc_func(args)
|
||||
|
Loading…
Reference in New Issue
Block a user