log = logging.getLogger(__name__)
class RGWEndpoint:
- def __init__(self, hostname=None, port=None, cert=None):
+ def __init__(self, hostname=None, port=None, cert=None, dns_name=None, website_dns_name=None):
self.hostname = hostname
self.port = port
self.cert = cert
+ self.dns_name = dns_name
+ self.website_dns_name = website_dns_name
def url(self):
proto = 'https' if self.cert else 'http'
kport=keystone_port),
])
+ if client_config.get('dns-name'):
+ rgw_cmd.extend(['--rgw-dns-name', endpoint.dns_name])
+ if client_config.get('dns-s3website-name'):
+ rgw_cmd.extend(['--rgw-dns-s3website-name', endpoint.website_dns_name])
+
rgw_cmd.extend([
'--foreground',
run.Raw('|'),
port = next_port
next_port += 1
- role_endpoints[role] = RGWEndpoint(remote.hostname, port, ssl_certificate)
+ # if dns-name is given, use it as the hostname (or as a prefix)
+ dns_name = client_config.get('dns-name', '')
+ if len(dns_name) == 0 or dns_name.endswith('.'):
+ 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
+
+ role_endpoints[role] = RGWEndpoint(remote.hostname, port, ssl_certificate, dns_name, website_dns_name)
return role_endpoints