scripts/rpc.py: rename mock_ functions
There will be one more "mocked" implementation soon, so make existing names more descriptive now. Change-Id: I30daf2b60ab683d5befb06eca50d455712858d61 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459390 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
31c25ab3ae
commit
c47d6541e0
@ -1813,11 +1813,11 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
if name in deprecated_aliases:
|
||||
print("{} is deprecated, use {} instead.".format(name, deprecated_aliases[name]), file=sys.stderr)
|
||||
|
||||
class mock_client:
|
||||
class dry_run_client:
|
||||
def call(self, method, params=None):
|
||||
print("Request:\n" + json.dumps({"method": method, "params": params}, indent=2))
|
||||
|
||||
def mock_print(arg):
|
||||
def null_print(arg):
|
||||
pass
|
||||
|
||||
def call_rpc_func(args):
|
||||
@ -1842,10 +1842,10 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.dry_run:
|
||||
args.client = mock_client()
|
||||
print_dict = mock_print
|
||||
print_json = mock_print
|
||||
print_array = mock_print
|
||||
args.client = dry_run_client()
|
||||
print_dict = null_print
|
||||
print_json = null_print
|
||||
print_array = null_print
|
||||
else:
|
||||
args.client = rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout, log_level=getattr(logging, args.verbose.upper()))
|
||||
if hasattr(args, 'func'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user