rpc.py: ignore lines starting with # on stdin

rpc.py users can pipe RPC calls through stdin, which
reduces overhead compared to calling rpc.py
separately for each RPC.

It is common to put these RPC calls in a file, and
then pipe that file to rpc.py.  To allow commenting
out RPC calls when doing debugging, have rpc.py
ignore any lines which begin with '#', allowing users
to comment out RPC calls (or even add comments
explaining the RPC calls) with a '#' character.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8d9c6ac95dd5864c16e4d69ba80f81799068e808
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11506
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2022-02-09 17:50:28 +00:00
parent 9cd85928e5
commit 70a6e3ac22

View File

@ -2863,7 +2863,11 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
if not rpc_call.strip():
continue
executed_rpc = "\n".join([executed_rpc, rpc_call])
args = parser.parse_args(shlex.split(rpc_call))
rpc_args = shlex.split(rpc_call)
if rpc_args[0][0] == '#':
# Ignore lines starting with # - treat them as comments
continue
args = parser.parse_args(rpc_args)
args.client = client
try:
call_rpc_func(args)