diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-11-21 03:38:49 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-11-21 08:09:42 +0000 |
commit | 777acd341ff407838440dae3ed69291ec4c52626 (patch) | |
tree | e08280b0239313a2e8235ce9ff5a7f573aa9e73e /functest/cli/commands/cli_os.py | |
parent | 3b80954f3caf36a957e7193db793ce318d51e58c (diff) |
Fix the way of getting endpoint port
It will fail if the endpoint does not contain any port value when
executing self.os_auth_url.rsplit("/")[2].rsplit(":")[1]
JIRA: FUNCTEST-892
Change-Id: Iba4103884b7c6e3b157bb95d775fac02c32ae728
Signed-off-by: Linda Wang <wangwulin@huawei.com>
(cherry picked from commit 45ad7723d0e40e7c5475584fc2a5bc0b5ad3ef56)
Diffstat (limited to 'functest/cli/commands/cli_os.py')
-rw-r--r-- | functest/cli/commands/cli_os.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py index e97ab0809..71cd78c58 100644 --- a/functest/cli/commands/cli_os.py +++ b/functest/cli/commands/cli_os.py @@ -9,6 +9,7 @@ import os +from urlparse import urlparse import click @@ -27,8 +28,8 @@ class OpenStack(object): self.openstack_creds = CONST.__getattribute__('openstack_creds') self.snapshot_file = CONST.__getattribute__('openstack_snapshot_file') if self.os_auth_url: - self.endpoint_ip = self.os_auth_url.rsplit("/")[2].rsplit(":")[0] - self.endpoint_port = self.os_auth_url.rsplit("/")[2].rsplit(":")[1] + self.endpoint_ip = urlparse(self.os_auth_url).hostname + self.endpoint_port = urlparse(self.os_auth_url).port def ping_endpoint(self): if self.os_auth_url is None: |