aboutsummaryrefslogtreecommitdiffstats
path: root/functest/api/resources/v1/creds.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2018-02-13 03:17:49 +0000
committerLinda Wang <wangwulin@huawei.com>2018-02-13 03:49:22 +0000
commitef798eee7e223b908361c7c79278cd347128a039 (patch)
tree633452756fd69c55ec7ce685a8e63f83e73305f4 /functest/api/resources/v1/creds.py
parent7598ab763d31ca4f901043722c19635b73f00d3f (diff)
Read env vars instead of using CONST in API
Also, improve the way of getting env values. JIRA: FUNCTEST-933 Change-Id: Ia66bbaf683df03c2874fafe578b84bb78a4f3fd1 Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/api/resources/v1/creds.py')
-rw-r--r--functest/api/resources/v1/creds.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/functest/api/resources/v1/creds.py b/functest/api/resources/v1/creds.py
index fefbbaa96..25c0fd242 100644
--- a/functest/api/resources/v1/creds.py
+++ b/functest/api/resources/v1/creds.py
@@ -39,7 +39,7 @@ class V1Creds(ApiResource):
endpoint='{0}/credentials'.format(ENDPOINT_CREDS))
def get(self): # pylint: disable=no-self-use
""" Get credentials """
- run_tests.Runner.source_envfile(CONST.__getattribute__('env_file'))
+ run_tests.Runner.source_envfile(getattr(CONST, 'env_file'))
credentials_show = OpenStack.show_credentials()
return jsonify(credentials_show)
@@ -65,7 +65,7 @@ class V1Creds(ApiResource):
lines = ['export {}={}\n'.format(k, v) for k, v in openrc_vars.items()]
- rc_file = CONST.__getattribute__('env_file')
+ rc_file = getattr(CONST, 'env_file')
with open(rc_file, 'w') as creds_file:
creds_file.writelines(lines)