]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/keystone: extract os_auth_args to helper function
authorCasey Bodley <cbodley@redhat.com>
Fri, 4 Aug 2023 16:00:28 +0000 (12:00 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 6 Oct 2023 14:41:35 +0000 (10:41 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
qa/tasks/keystone.py

index f0f09842e60505a938f8841cfce66d96f038d903..27e808f688352979b0a0a87e03f2a989b808f48d 100644 (file)
@@ -326,25 +326,26 @@ def dict_to_args(specials, items):
     args.extend(arg for arg in special_vals.values() if arg)
     return args
 
+def os_auth_args(host, port):
+    return [
+        '--os-username', 'admin',
+        '--os-password', 'ADMIN',
+        '--os-user-domain-id', 'default',
+        '--os-project-name', 'admin',
+        '--os-project-domain-id', 'default',
+        '--os-identity-api-version', '3',
+        '--os-auth-url', 'http://{host}:{port}/v3'.format(host=host, port=port),
+    ]
+
 def run_section_cmds(ctx, cclient, section_cmd, specials,
                      section_config_list):
     public_host, public_port = ctx.keystone.public_endpoints[cclient]
-
-    auth_section = [
-        ( 'os-username', 'admin' ),
-        ( 'os-password', 'ADMIN' ),
-        ( 'os-user-domain-id', 'default' ),
-        ( 'os-project-name', 'admin' ),
-        ( 'os-project-domain-id', 'default' ),
-        ( 'os-identity-api-version', '3' ),
-        ( 'os-auth-url', 'http://{host}:{port}/v3'.format(host=public_host,
-                                                          port=public_port) ),
-    ]
+    auth_args = os_auth_args(public_host, public_port)
 
     for section_item in section_config_list:
         run_in_keystone_venv(ctx, cclient,
-            [ 'openstack' ] + section_cmd.split() +
-            dict_to_args(specials, auth_section + list(section_item.items())) +
+            [ 'openstack' ] + section_cmd.split() + auth_args +
+            dict_to_args(specials, list(section_item.items())) +
             [ '--debug' ])
 
 def create_endpoint(ctx, cclient, service, url, adminurl=None):