aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/openstack_utils.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-14 16:02:53 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-16 10:24:22 +0100
commitd589e4e5345ed82c68d9a011ac89f8cdbefe2ca3 (patch)
tree1ec221f1f95e6abaec9b1465e9e46b76f8777a27 /functest/utils/openstack_utils.py
parent98e2806cb674d206dea65647c0644dc5b2871b4b (diff)
Get properly env vars or their default values
It defines env.get() as an unique way to get Functest env vars or their default values. It can be considered as a wrapper above os.environ. It enforces backward compatibility via CONST which mustn't be used for that purpose. It should be noted that it also stops using CONST for getting OpenStack env vars. Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/utils/openstack_utils.py')
-rw-r--r--functest/utils/openstack_utils.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index b779997c..98da48b8 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -22,7 +22,7 @@ from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
-from functest.utils.constants import CONST
+from functest.utils import env
import functest.utils.functest_utils as ft_utils
logger = logging.getLogger(__name__)
@@ -659,8 +659,8 @@ def get_private_net(neutron_client):
def get_external_net(neutron_client):
- if (hasattr(CONST, 'EXTERNAL_NETWORK')):
- return CONST.__getattribute__('EXTERNAL_NETWORK')
+ if (env.get('EXTERNAL_NETWORK')):
+ return env.get('EXTERNAL_NETWORK')
for network in neutron_client.list_networks()['networks']:
if network['router:external']:
return network['name']
@@ -668,9 +668,9 @@ def get_external_net(neutron_client):
def get_external_net_id(neutron_client):
- if (hasattr(CONST, 'EXTERNAL_NETWORK')):
+ if (env.get('EXTERNAL_NETWORK')):
networks = neutron_client.list_networks(
- name=CONST.__getattribute__('EXTERNAL_NETWORK'))
+ name=env.get('EXTERNAL_NETWORK'))
net_id = networks['networks'][0]['id']
return net_id
for network in neutron_client.list_networks()['networks']: