Drop configure_tls northd workaround

The ovn-northd daemon has gained support for runtime reload of
certificate data [0] and is now on par with the other OVS/OVN
daemons.

Remove the workaround from the charm.

0: https://github.com/ovn-org/ovn/commit/8de4f8005f210
Closes-Bug: #1895303
Change-Id: I7f45b36e03b985ba2d170ead391615f9ef9dad8e
This commit is contained in:
Frode Nordahl
2022-07-08 15:27:01 +02:00
parent 16f821dd72
commit 5d5d089cd4
2 changed files with 13 additions and 27 deletions
+13 -19
View File
@@ -406,26 +406,20 @@ class BaseOVNCentralCharm(charms_openstack.charm.OpenStackCharm):
tls_objects = self.get_certs_and_keys(
certificates_interface=certificates_interface)
with charms_openstack.charm.utils.is_data_changed(
'configure_tls.tls_objects', tls_objects) as changed:
for tls_object in tls_objects:
with open(
self.options.ovn_ca_cert, 'w') as crt:
chain = tls_object.get('chain')
if chain:
crt.write(tls_object['ca'] + os.linesep + chain)
else:
crt.write(tls_object['ca'])
for tls_object in tls_objects:
with open(
self.options.ovn_ca_cert, 'w') as crt:
chain = tls_object.get('chain')
if chain:
crt.write(tls_object['ca'] + os.linesep + chain)
else:
crt.write(tls_object['ca'])
self.configure_cert(self.ovn_sysconfdir(),
tls_object['cert'],
tls_object['key'],
cn='host')
if changed:
# The `ovn-northd` daemon will not detect changes to the
# certificate data and needs to be restarted. LP: #1895303
self.service_reload('ovn-northd')
break
self.configure_cert(self.ovn_sysconfdir(),
tls_object['cert'],
tls_object['key'],
cn='host')
break
def configure_ovn_listener(self, db, port_map):
"""Create or update OVN listener configuration.
@@ -224,10 +224,6 @@ class TestOVNCentralCharm(Helper):
'ca': 'fakeca',
'chain': 'fakechain',
}]
self.patch_target('service_reload')
self.patch('charms_openstack.charm.utils.is_data_changed',
name='is_data_changed')
self.is_data_changed().__enter__.return_value = False
with mock.patch('builtins.open', create=True) as mocked_open:
mocked_file = mock.MagicMock(spec=io.FileIO)
mocked_open.return_value = mocked_file
@@ -242,10 +238,6 @@ class TestOVNCentralCharm(Helper):
'fakecert',
'fakekey',
cn='host')
self.assertFalse(self.service_reload.called)
self.is_data_changed().__enter__.return_value = True
self.target.configure_tls()
self.service_reload.assert_called_once_with('ovn-northd')
def test_configure_ovn_listener(self):
self.patch_object(ovn_central.ch_ovsdb, 'SimpleOVSDB')