Prevent error if cert has no chain info

Change-Id: Ib2f52ef63cec268c30ab74f928f4db85677f028a
Closes-Bug: #1850659
This commit is contained in:
Edward Hope-Morley 2019-10-30 15:40:42 +00:00
parent c32e82e236
commit 0b4b89340d
1 changed files with 6 additions and 4 deletions

View File

@ -52,10 +52,12 @@ class NeutronAPIPluginCharm(charms_openstack.charm.OpenStackCharm):
for tls_object in tls_objects:
with open(ovn_ca_cert(self.adapters_instance), 'w') as crt:
crt.write(
tls_object['ca'] +
os.linesep +
tls_object.get('chain', ''))
chain = tls_object.get('chain')
if chain:
crt.write(tls_object['ca'] + os.linesep + chain)
else:
crt.write(tls_object['ca'])
self.configure_cert(NEUTRON_PLUGIN_ML2_DIR,
tls_object['cert'],
tls_object['key'],