Merge "Stop setting ext net in config"
[functest.git] / functest / cli / commands / cli_os.py
index 9057da8..7595caa 100644 (file)
@@ -5,13 +5,13 @@
 # are made available under the terms of the Apache License, Version 2.0
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
-#
 
+# pylint: disable=missing-docstring
 
 import os
 
 import click
-from six.moves.urllib.parse import urlparse
+from six.moves import urllib
 
 from functest.ci import check_deployment
 from functest.utils.constants import CONST
@@ -23,14 +23,14 @@ class OpenStack(object):
         self.os_auth_url = CONST.__getattribute__('OS_AUTH_URL')
         self.endpoint_ip = None
         self.endpoint_port = None
-        self.openstack_creds = CONST.__getattribute__('openstack_creds')
+        self.openstack_creds = CONST.__getattribute__('env_file')
         if self.os_auth_url:
-            self.endpoint_ip = urlparse(self.os_auth_url).hostname
-            self.endpoint_port = urlparse(self.os_auth_url).port
+            self.endpoint_ip = urllib.parse.urlparse(self.os_auth_url).hostname
+            self.endpoint_port = urllib.parse.urlparse(self.os_auth_url).port
 
     def ping_endpoint(self):
         if self.os_auth_url is None:
-            click.echo("Source the OpenStack credentials first '. $creds'")
+            click.echo("Source the OpenStack credentials first")
             exit(0)
         response = os.system("ping -c 1 " + self.endpoint_ip + ">/dev/null")
         if response == 0:
@@ -55,12 +55,9 @@ class OpenStack(object):
 
 class CliOpenStack(OpenStack):
 
-    def __init__(self):
-        super(CliOpenStack, self).__init__()
-
     @staticmethod
     def show_credentials():
         dic_credentials = OpenStack.show_credentials()
         for key, value in dic_credentials.items():
-                if key.startswith('OS_'):
-                    click.echo("{}={}".format(key, value))
+            if key.startswith('OS_'):
+                click.echo("{}={}".format(key, value))