From d7ca703598f48b6d2f9346de3ab6b253c915789e Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 21 Feb 2018 15:31:53 +0100 Subject: Switch to os.environ for getting OpenStack env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sfc/lib/openstack_utils.py | 8 ++++---- 1 file 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')) -- cgit 1.2.3-korg