]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/rgw: allow the rgw teuthology task to capture/set dns names
authorJ. Eric Ivancich <ivancich@redhat.com>
Tue, 21 Apr 2020 15:28:58 +0000 (15:28 +0000)
committerJ. Eric Ivancich <ivancich@redhat.com>
Wed, 15 Jul 2020 16:17:51 +0000 (12:17 -0400)
A teuthology workunit might want to use the rgw task, setting the
rgw-dns-name and/or rgw-dns-s3website-name configuration options to
the fully-qualified domain name. Existing code implies that setting
these configuration options to the empty string will do that. However
the current logic does not support that given it has Python
conditionals that treat the empty string as false. This fixes that.

Now the following teuthology tasks YAML will work as expected:

  tasks:
  - rgw:
      client.0:
        dns-name: ''
        dns-s3website-name: ''

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 89654d0477a25592fafbc438aacce12988dc23c1)

qa/tasks/rgw.py

index 6056d220066598ab3508f9341dfc6a5c4c8e6466..e747426c374939f93ed9bbb37b21f081cbb77aee 100644 (file)
@@ -103,9 +103,10 @@ def start_rgw(ctx, config, clients):
                                                 kport=keystone_port),
                 ])
 
-        if client_config.get('dns-name'):
+
+        if client_config.get('dns-name') is not None:
             rgw_cmd.extend(['--rgw-dns-name', endpoint.dns_name])
-        if client_config.get('dns-s3website-name'):
+        if client_config.get('dns-s3website-name') is not None:
             rgw_cmd.extend(['--rgw-dns-s3website-name', endpoint.website_dns_name])
 
         rgw_cmd.extend([
@@ -188,9 +189,8 @@ def assign_endpoints(ctx, config, default_cert):
             dns_name += remote.hostname
 
         website_dns_name = client_config.get('dns-s3website-name')
-        if website_dns_name:
-            if len(website_dns_name) == 0 or website_dns_name.endswith('.'):
-                website_dns_name += remote.hostname
+        if website_dns_name is not None and (len(website_dns_name) == 0 or website_dns_name.endswith('.')):
+            website_dns_name += remote.hostname
 
         role_endpoints[role] = RGWEndpoint(remote.hostname, port, ssl_certificate, dns_name, website_dns_name)