aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-21 15:31:53 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-21 15:31:53 +0100
commitd7ca703598f48b6d2f9346de3ab6b253c915789e (patch)
tree0ae756953c341bade6e42630eb4fcda6d48eb42a
parente55afb91505df4832e9d54fc794e97fdda35b7df (diff)
Switch to os.environ for getting OpenStack env vars
CONST shouldn't be selected to get env vars. Now it may raise KeyErrors if env is not well configured. Change-Id: I5e3f525640809778c5349fdc1c3796227894d0cd Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--sfc/lib/openstack_utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index 362d7308..37ad36f0 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -5,6 +5,7 @@ import json
import yaml
from tackerclient.tacker import client as tackerclient
from functest.utils.constants import CONST
+from functest.utils import env
from snaps.openstack.tests import openstack_tests
@@ -80,7 +81,7 @@ class OpenStackSFC:
self.creators.append(network_creator)
# Router
- ext_network_name = CONST.__getattribute__('EXTERNAL_NETWORK')
+ ext_network_name = env.get('EXTERNAL_NETWORK')
router_settings = RouterConfig(name=router_name,
external_gateway=ext_network_name,
@@ -582,9 +583,8 @@ def register_vim(tacker_client, vim_file=None):
with open(vim_file) as f:
json_dict = json.load(f)
- json_dict['vim']['auth_url'] = CONST.__getattribute__('OS_AUTH_URL')
- json_dict['vim']['auth_cred']['password'] = CONST.__getattribute__(
- 'OS_PASSWORD')
+ json_dict['vim']['auth_url'] = os.environ['OS_AUTH_URL']
+ json_dict['vim']['auth_cred']['password'] = os.environ['OS_PASSWORD']
json.dump(json_dict, open(tmp_file, 'w'))