Fix certmon for non-DC systems

This commit restores the original logic for certmon service
startup. Added a note that the dc_role can be None, which
is a possible code path that was missed in the previous
two bug-fix commits.

Test Plan
PASS: Verify certmon startup for DC and non-DC roles

Closes-Bug: 1998508

Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: Iabc23aac20a35336cfe1b7f9c26b59fae49b69fb
This commit is contained in:
Kyle MacLeod 2022-12-01 13:02:27 -05:00
parent e6d29d951b
commit 6613e4c46c
1 changed files with 9 additions and 3 deletions

View File

@ -53,18 +53,24 @@ class CertificateMonitorService(service.Service):
super(CertificateMonitorService, self).start()
self._get_dc_role()
self.manager.start_monitor(self.dc_role)
self.manager.start_audit()
# Note: self.dc_role can be None (if non-DC system):
if self.dc_role == constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
self.manager.start_audit()
self.target = oslo_messaging.Target(
version=self.rpc_api_version,
server=CONF.host,
topic=self.topic)
self._rpc_server = rpc_messaging.get_rpc_server(self.target, self)
self._rpc_server.start()
elif self.dc_role == constants.DISTRIBUTED_CLOUD_ROLE_SUBCLOUD:
self.manager.start_audit()
def stop(self):
self._stop_rpc_server()
self.manager.stop_audit()
if self.dc_role == constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
self._stop_rpc_server()
self.manager.stop_audit()
elif self.dc_role == constants.DISTRIBUTED_CLOUD_ROLE_SUBCLOUD:
self.manager.stop_audit()
self.manager.stop_monitor()
super(CertificateMonitorService, self).stop()
rpc_messaging.cleanup()