API replay: don't assume barbican is enabled

Use an option to explicitly enable barbican for Octavia replay

Change-Id: Id76cede61da108978d16b0d200ed5a8c87d1764f
This commit is contained in:
Salvatore Orlando 2021-07-21 06:20:38 -07:00
parent f3d16822a5
commit fce91f9962
2 changed files with 19 additions and 9 deletions

View File

@ -49,6 +49,7 @@ class ApiReplayCli(object):
dest_os_auth_url=args.dest_os_auth_url,
dest_os_endpoint_url=args.dest_os_endpoint_url,
dest_plugin=args.dest_plugin,
enable_barbican=args.enable_barbican,
use_old_keystone=args.use_old_keystone,
octavia_os_tenant_name=args.octavia_os_project_name,
octavia_os_tenant_domain_id=args.octavia_os_project_domain_id,
@ -201,6 +202,11 @@ class ApiReplayCli(object):
"--max-retry",
default=10,
help="Maximum number of retrying different operations.")
parser.add_argument(
"--enable-barbican",
default=False,
action='store_true',
help="Meh")
# NOTE: this will return an error message if any of the
# require options are missing.

View File

@ -52,6 +52,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
dest_os_username, dest_os_user_domain_id,
dest_os_tenant_name, dest_os_tenant_domain_id,
dest_os_password, dest_os_auth_url, dest_os_endpoint_url,
enable_barbican,
dest_plugin, use_old_keystone,
octavia_os_username, octavia_os_user_domain_id,
octavia_os_tenant_name, octavia_os_tenant_domain_id,
@ -120,14 +121,17 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
password=octavia_os_password,
auth_url=octavia_os_auth_url,
cert_file=cert_file)
self.barbican = self.connect_to_barbican(
username=octavia_os_username,
user_domain_id=octavia_os_user_domain_id,
tenant_name=octavia_os_tenant_name,
tenant_domain_id=octavia_os_tenant_domain_id,
password=octavia_os_password,
auth_url=octavia_os_auth_url,
cert_file=cert_file)
if enable_barbican:
self.barbican = self.connect_to_barbican(
username=octavia_os_username,
user_domain_id=octavia_os_user_domain_id,
tenant_name=octavia_os_tenant_name,
tenant_domain_id=octavia_os_tenant_domain_id,
password=octavia_os_password,
auth_url=octavia_os_auth_url,
cert_file=cert_file)
else:
self.barbican = None
else:
self.octavia = None
self.barbican = None
@ -1068,7 +1072,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
cert_data.private_key_passphrase.payload)
return None
if listener_dict.get('default_tls_container_ref'):
if listener_dict.get('default_tls_container_ref') and self.barbican:
cert_data = self.barbican.containers.get(
container_ref=listener_dict['default_tls_container_ref'])
return {'ref': listener_dict['default_tls_container_ref'],