rpc.py: add new kv to existing params dict
When we get an error when calling an RPC, client.py makes extensive use of the ** operator to add the method and req_id to the params dict variable. This doens't work with Python 2. We don't really support Python 2, but there are at least some folks out there who make their own mods to get rpc.py to work with it. We can very easily implement this in a way that is Python 2 friendly, so let's do that to make it a tiny bit easier for those folks. Incidentally, I do think the changes here also make this part of the code a bit easier to read and understand. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I1846c80e21032ffba67128bee946b041a61d0621 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476632 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
cd433e7ef9
commit
8bc9798dc7
@ -158,8 +158,9 @@ class JSONRPCClient(object):
|
||||
raise e
|
||||
|
||||
if 'error' in response:
|
||||
msg = "\n".join(["request:", "%s" % json.dumps({**{"method": method, "req_id": req_id},
|
||||
**params}, indent=2),
|
||||
params["method"] = method
|
||||
params["req_id"] = req_id
|
||||
msg = "\n".join(["request:", "%s" % json.dumps(params, indent=2),
|
||||
"Got JSON-RPC error response",
|
||||
"response:",
|
||||
json.dumps(response['error'], indent=2)])
|
||||
|
Loading…
Reference in New Issue
Block a user