Add explicit check for rpc is not None

This change tests for the rpc value passed to the driver to be not None.
The explicity check does not change the logic and avoid a difference in
Python 2 vs Python 3 to resolve the boolean value of an object. Python 2
calls __nonzero__() to get boolean value of an object and Python 3
calls __boolean__().

Change-Id: I50a228840735bc1a7b0d857d0b28e01b4f836aef
changes/28/449828/1
Mark McClain 6 years ago
parent 16800bddbb
commit 6d2d1c34af

@ -77,7 +77,7 @@ class AristaDriver(driver_api.MechanismDriver):
self.eapi = None
if rpc:
if rpc is not None:
LOG.info("Using passed in parameter for RPC")
self.rpc = rpc
self.eapi = rpc

@ -378,7 +378,6 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
expected_calls = [
mock.call.NeutronNets(),
mock.call.__nonzero__(),
mock.call.is_port_provisioned(port_id),
mock.call.is_network_provisioned(tenant_id, network_id, None),
mock.call.plug_port_into_network(device_id, host_id, port_id,
@ -525,7 +524,6 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
expected_calls = [
mock.call.NeutronNets(),
mock.call.__nonzero__(),
mock.call.get_physical_network(host_id),
mock.call.is_network_provisioned(tenant_id, network_id, None,
None),
@ -633,7 +631,6 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
expected_calls = [
mock.call.NeutronNets(),
mock.call.__nonzero__(),
mock.call.is_network_provisioned(tenant_id, network_id,
segmentation_id,
segment_id),
@ -801,7 +798,6 @@ class AristaDriverTestCase(testlib_api.SqlTestCase):
expected_calls = [
mock.call.NeutronNets(),
mock.call.__nonzero__(),
mock.call.is_port_provisioned(port_id, None),
mock.call.is_network_provisioned(tenant_id, network_id,
None, None),

Loading…
Cancel
Save