aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/openstack_utils.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-04-27 07:36:32 +0000
committerLinda Wang <wangwulin@huawei.com>2017-04-27 07:42:58 +0000
commit07add72756bcfbc010887c8c41077c65c8edd5c9 (patch)
treee189c35b6596821e8187c0710deea2b6366b63f3 /functest/utils/openstack_utils.py
parent0acb8eb018afd993c363c05da8a45091abc59fd9 (diff)
Update rally_conf.json for creating deployment
1. The rally_conf.json is obtained via def get_credentials_for_rally(), where the parameter endpoint_type is supposed to get from the env OS_ENDPOINT_TYPE or OS_INTERFACE, just as the def get_creds_from_env_vars() in rally project [1]. [1] https://github.com/openstack/rally/blob/master/rally/cli/envutils.py JIRA: FUNCTEST-801 Change-Id: I6b6be82b9ff7f04948b47c4fca836d415fe13f8b Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/utils/openstack_utils.py')
-rw-r--r--functest/utils/openstack_utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 929a761e..702acc02 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -139,11 +139,11 @@ def get_credentials_for_rally():
endpoint_types = [('internalURL', 'internal'),
('publicURL', 'public'), ('adminURL', 'admin')]
- endpoint_type = os.getenv('OS_ENDPOINT_TYPE')
+ endpoint_type = get_endpoint_type_from_env()
if endpoint_type is not None:
cred_key = env_cred_dict.get('OS_ENDPOINT_TYPE')
for k, v in endpoint_types:
- if endpoint_type == k:
+ if endpoint_type == v:
rally_conf[cred_key] = v
region_name = os.getenv('OS_REGION_NAME')
@@ -158,6 +158,14 @@ def get_credentials_for_rally():
return rally_conf
+def get_endpoint_type_from_env():
+ endpoint_type = os.environ.get("OS_ENDPOINT_TYPE",
+ os.environ.get("OS_INTERFACE"))
+ if endpoint_type and "URL" in endpoint_type:
+ endpoint_type = endpoint_type.replace("URL", "")
+ return endpoint_type
+
+
def get_session_auth(other_creds={}):
loader = loading.get_plugin_loader('password')
creds = get_credentials(other_creds)