Update subprocess code to be compliant with Python2 and update credentials for Swift... 57/21757/1
authorThomas Duval <thomas.duval@orange.com>
Wed, 7 Sep 2016 12:09:19 +0000 (14:09 +0200)
committerThomas Duval <thomas.duval@orange.com>
Tue, 20 Sep 2016 08:38:37 +0000 (10:38 +0200)
Change-Id: I571f3c48765da02ed7ad6c23b006afe0f97a8636
(cherry picked from commit 705b9d51a9d81ca75b07f71c09d9a4e9f35ed49a)

moonclient/moonclient/shell.py
moonclient/moonclient/tests.py
moonclient/moonclient/tests/tests_empty_policy_swift.json
tests/run_tests.py

index d1d0251..8be7362 100644 (file)
@@ -135,9 +135,12 @@ class MoonClient(App):
     def nb_error(self):
         return self._nb_error
 
-    def incr_error(self):
+    def incr_error(self, msg=""):
         self._nb_error += 1
-        print("INCREMENTING ERRORS {}".format(self._nb_error))
+        if not msg:
+            print("INCREMENTING ERRORS {}".format(self._nb_error))
+        else:
+            print("INCREMENTING ERRORS {} [{}]".format(self._nb_error, msg))
 
     def get_tenant_uuid(self, tenant_name):
         return self.get_url("/v3/projects?name={}".format(tenant_name), authtoken=True, port=5000)["projects"][0]["id"]
index 3ef2aa9..b2c02f1 100644 (file)
@@ -220,7 +220,7 @@ class TestsLaunch(Lister):
                         overall_result = overall_result and True
                     else:
                         compare = "\033[1m\033[31mFalse\033[m"
-                        self.app.incr_error()
+                        self.app.incr_error(error_str)
                         overall_result = overall_result and False
                 else:
                     overall_result = overall_result and compare
index 6d8de2e..e935da9 100644 (file)
@@ -4,7 +4,8 @@
     "authz": [
       {
         "auth_name": "admin",
-        "auth_tenant": "demo",
+        "auth_password": "console",
+        "auth_tenant": "admin",
         "description": "Change user to admin (just in case...)"
       },
 
index 7c48e26..012e173 100755 (executable)
@@ -49,14 +49,14 @@ except ImportError:
 
 
 def __get_endpoint_url(name="keystone"):
-    with subprocess.Popen(["openstack", "endpoint", "show", name, "-f", "yaml"], stdout=subprocess.PIPE) as proc:
-        y = yaml.load(proc.stdout.read())
-        url = y['publicurl']
-        url = url.replace("http://", "")
-        url = url.replace("https://", "")
-        host, port = url.split(":", maxsplit=1)
-        port = port.split("/")[0]
-        return host, port
+    proc = subprocess.Popen(["openstack", "endpoint", "show", name, "-f", "yaml"], stdout=subprocess.PIPE)
+    y = yaml.load(proc.stdout.read())
+    url = y['publicurl']
+    url = url.replace("http://", "")
+    url = url.replace("https://", "")
+    host, port = url.split(":")
+    port = port.split("/")[0]
+    return host, port
 
 
 def test_federation():