aboutsummaryrefslogtreecommitdiffstats
path: root/functest/cli
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-11-21 03:38:49 +0000
committerLinda Wang <wangwulin@huawei.com>2017-11-21 07:18:58 +0000
commit45ad7723d0e40e7c5475584fc2a5bc0b5ad3ef56 (patch)
treefc45143484327017b15d567e55ad6cd9658b348d /functest/cli
parent587f9163769f988a8a3ba592dc10ef2d994588e8 (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>
Diffstat (limited to 'functest/cli')
-rw-r--r--functest/cli/commands/cli_os.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index e97ab080..71cd78c5 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: