2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

jsonrpc.py: Don't swallow errors in transact_block().

If a server returned an error in response to a request,
transact_block() would ignore it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Ethan Jackson
2012-02-16 20:26:35 -08:00
parent 2ac7bbf5b1
commit 66eb76d0fc
2 changed files with 9 additions and 1 deletions

View File

@@ -301,7 +301,10 @@ class Connection(object):
reply = None
while not error:
error, reply = self.recv_block()
if reply and reply.type == Message.T_REPLY and reply.id == id_:
if (reply
and (reply.type == Message.T_REPLY
or reply.type == Message.T_ERROR)
and reply.id == id_):
break
return error, reply

View File

@@ -375,6 +375,11 @@ def do_idl(schema_file, remote, *commands):
sys.stderr.write("jsonrpc transaction failed: %s"
% os.strerror(error))
sys.exit(1)
elif reply.error is not None:
sys.stderr.write("jsonrpc transaction failed: %s"
% reply.error)
sys.exit(1)
sys.stdout.write("%03d: " % step)
sys.stdout.flush()
step += 1