]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/rgw: swift task looks for rgw_server endpoint
authorCasey Bodley <cbodley@redhat.com>
Mon, 1 Jul 2019 16:07:16 +0000 (12:07 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 8 Jul 2019 14:45:46 +0000 (10:45 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 5e667c4f73b1f064cc324bcaff9fe35ca9a4abc6)

qa/tasks/swift.py

index c37eb88385c9e67ef4698242add0786d1fb4b649..491efb95b9fa2f05fa94f7b652ca0b95f060a5f0 100644 (file)
@@ -127,19 +127,6 @@ def configure(ctx, config):
         log.info('client={c}'.format(c=client))
         log.info('config={c}'.format(c=config))
         testswift_conf = config['testswift_conf'][client]
-        if properties is not None and 'rgw_server' in properties:
-            host = None
-            for target, roles in zip(ctx.config['targets'].iterkeys(), ctx.config['roles']):
-                log.info('roles: ' + str(roles))
-                log.info('target: ' + str(target))
-                if properties['rgw_server'] in roles:
-                    _, host = split_user(target)
-            assert host is not None, "Invalid client specified as the rgw_server"
-            testswift_conf['func_test']['auth_host'] = host
-        else:
-            testswift_conf['func_test']['auth_host'] = 'localhost'
-
-        log.info(client)
         (remote,) = ctx.cluster.only(client).remotes.keys()
         remote.run(
             args=[
@@ -235,10 +222,7 @@ def task(ctx, config):
 
     testswift_conf = {}
     clients = []
-    for client in config.keys():
-        endpoint = ctx.rgw.role_endpoints.get(client)
-        assert endpoint, 'swift: no rgw endpoint for {}'.format(client)
-
+    for client, client_config in config.iteritems():
         # http://tracker.ceph.com/issues/40304 can't bootstrap on rhel 7.6+
         (remote,) = ctx.cluster.only(client).remotes.keys()
         if remote.os.name == 'rhel' and LooseVersion(remote.os.version) >= LooseVersion('7.6'):
@@ -247,12 +231,17 @@ def task(ctx, config):
 
         clients.append(client)
 
+        server = client_config.get('rgw_server', client)
+        endpoint = ctx.rgw.role_endpoints.get(server)
+        assert endpoint, 'swift: no rgw endpoint for {}'.format(server)
+
         testswift_conf[client] = ConfigObj(
                 indent_type='',
                 infile={
                     'func_test':
                         {
-                        'auth_port'      : endpoint.port,
+                        'auth_host' : endpoint.hostname,
+                        'auth_port' : endpoint.port,
                         'auth_ssl' : 'yes' if endpoint.cert else 'no',
                         'auth_prefix' : '/auth/',
                         },