summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-04-29 18:38:48 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-05-15 11:37:34 +0200
commitd9f602981b0e695504061ba7a9862ec53082b82a (patch)
tree136c604ab0261356db355a367b37861f3acb3164
parent1f70aa1b7278b85ca585c8181522b61f10bc4e83 (diff)
Fix NoneType in create_router.py
It lets Neutron handle str or unicode instead of returning None. It reverts the first proposal [1] which raises side effects [2]. [1] https://gerrit.opnfv.org/gerrit/#/c/56171/ [2] https://build.opnfv.org/ci/view/functest/job/functest-compass-baremetal-daily-master/126/console Conflict: snaps/openstack/create_router.py Change-Id: I1b45c7d6118321dd67343f31253f154abae73655 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 9651c889f1b966dc2733daf7eabbb5e62268654d)
-rw-r--r--snaps/openstack/create_router.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/snaps/openstack/create_router.py b/snaps/openstack/create_router.py
index 260fc03..0b93359 100644
--- a/snaps/openstack/create_router.py
+++ b/snaps/openstack/create_router.py
@@ -149,10 +149,6 @@ class OpenStackRouter(OpenStackNetworkObject):
:param sub_config:
:return:
"""
- if isinstance(sub_config, str):
- return neutron_utils.get_subnet_by_name(
- self._neutron, self._keystone,
- subnet_name=sub_config)
if isinstance(sub_config, dict):
sub_dict = sub_config['subnet']
network = neutron_utils.get_network(
@@ -163,6 +159,10 @@ class OpenStackRouter(OpenStackNetworkObject):
return neutron_utils.get_subnet(
self._neutron, network,
subnet_name=sub_dict['subnet_name'])
+ else:
+ return neutron_utils.get_subnet_by_name(
+ self._neutron, self._keystone,
+ subnet_name=sub_config)
def clean(self):
"""