API replay: authenticated connection with custom endpoint_url

Use keystone auth for the destination endpoint even when the endpoint
URI is not retrieved from the service catalog.

Change-Id: I3ff630745dadd5b44f202e9b75ec6edf6fb6b59e
This commit is contained in:
Salvatore Orlando 2021-07-19 12:15:42 -07:00 committed by Salvatore Orlando
parent debc8b2b64
commit f0db06b8d3
1 changed files with 7 additions and 5 deletions

View File

@ -99,7 +99,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
tenant_name=dest_os_tenant_name,
password=dest_os_password,
auth_url=dest_os_auth_url)
elif dest_os_endpoint_url:
elif dest_os_endpoint_url and not dest_os_password:
self.dest_neutron = self.connect_to_local_client(
endpoint_url=dest_os_endpoint_url)
else:
@ -110,7 +110,8 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
tenant_domain_id=dest_os_tenant_domain_id,
password=dest_os_password,
auth_url=dest_os_auth_url,
cert_file=cert_file)
cert_file=cert_file,
endpoint_url=dest_os_endpoint_url)
if octavia_os_auth_url:
self.octavia = self.connect_to_octavia(
@ -208,18 +209,19 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
def connect_to_client(self, username, user_domain_id,
tenant_name, tenant_domain_id,
password, auth_url, cert_file):
password, auth_url, cert_file,
endpoint_url=None):
sess = self._get_session(username, user_domain_id,
tenant_name, tenant_domain_id,
password, auth_url, cert_file)
neutron = client.Client(session=sess)
neutron = client.Client(session=sess,
endpoint_override=endpoint_url)
return neutron
def connect_to_local_client(self, endpoint_url):
neutron = client.Client(endpoint_url=endpoint_url,
insecure=True,
auth_strategy='noauth')
# test the connection:
return neutron
def connect_to_octavia(self, username, user_domain_id,