Fix service_name in process_certificates call

Fix service_name when calling process_certificates so it matches
what ApacheSSLContext expects.

Ceilometers Apache config is rendered using
ceilometer_contexts.ApacheSSLContext. This class is a subclass of
charmhelpers.contrib.openstack.context.ApacheSSLContext. The
ceilometer specialised class sets 'service_namespace = "ceilometer"'.
This is then used by parent class to set the destination for certs
and keys to:

ssl_dir = os.path.join('/etc/apache2/ssl/', self.service_namespace)

The code to process incoming certificates from the certificates
relation does something very similar.
charmhelpers.contrib.openstack.cert_utils.process_certificates
takes a service_name parameter. It uses this to set the destination
directory that incoming certificates will be stored in:

ssl_dir = os.path.join('/etc/apache2/ssl/', service_name)

Obviously these two ssl directories need to match. But they do not
because process_certificates is currently called like this:

cert_utils.process_certificates('ceilometer-api', relation_id, unit)

Change-Id: I41a26d00b4d2b22a5cfd2ef38ec76f2efd13f75b
Closes-Bug: #1849292
This commit is contained in:
Liam Young 2019-10-22 11:04:55 +00:00
parent 9cb5185253
commit 1c5865f4f9
2 changed files with 2 additions and 2 deletions

View File

@ -492,7 +492,7 @@ def certs_joined(relation_id=None):
def certs_changed(relation_id=None, unit=None):
@restart_on_change(restart_map())
def _certs_changed():
cert_utils.process_certificates('ceilometer-api', relation_id, unit)
cert_utils.process_certificates('ceilometer', relation_id, unit)
configure_https()
_certs_changed()

View File

@ -477,5 +477,5 @@ class CeilometerHooksTest(CharmTestCase):
def test_certs_changed(self, _process_certificates, _configure_https):
hooks.hooks.execute(['hooks/certificates-relation-changed'])
_process_certificates.assert_called_once_with(
'ceilometer-api', None, None)
'ceilometer', None, None)
_configure_https.assert_called_once_with()