Change in vdsm[master]: hooks: make sure that hook error inherits from vdsm exception
nsoffer at redhat.com
nsoffer at redhat.com
Sat Jan 16 20:32:19 UTC 2016
Nir Soffer has posted comments on this change.
Change subject: hooks: make sure that hook error inherits from vdsm exception
......................................................................
Patch Set 4:
(2 comments)
https://gerrit.ovirt.org/#/c/51549/4/tests/bridgeTests.py
File tests/bridgeTests.py:
Line 160:
Line 161: obj = json.loads(msg, 'utf-8')
Line 162: mangledMethod = obj.get("method").replace(".", "_")
Line 163: params = obj.get('params', [])
Line 164: method = getattr(bridge, mangledMethod)
It seems that most of the code in this test is unneeded, and the same it true for other tests.
The minimal code needed is:
bridge = DymanicBridge()
with self.assertRaises(JsonRpcError) as e:
bridge.Host_ping()
self.assertEqual(e.excepiton.code, 1500)
Lets clean up the tests later.
Line 165:
Line 166: with self.assertRaises(JsonRpcError) as e:
Line 167: method(**params)
Line 168:
https://gerrit.ovirt.org/#/c/51549/4/vdsm/rpc/Bridge.py
File vdsm/rpc/Bridge.py:
Line 282: except TypeError as e:
Line 283: self.log.exception("TypeError raised by dispatched function")
Line 284: raise InvalidCall(fn, methodArgs, e)
Line 285: except VdsmException as e:
Line 286: raise yajsonrpc.JsonRpcError(e.code, str(e))
We have 2 changes here - 1. Moving HooksError to vdsm.exception, 2. Supporting vdsm exceptions in the bridge. Would you separate them?
Line 287:
Line 288: if result['status']['code']:
Line 289: code = result['status']['code']
Line 290: msg = result['status']['message']
--
To view, visit https://gerrit.ovirt.org/51549
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9c0e953f96827737eede22ab39a1f7689c30944
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list