From 6613e4c46c84752d25c7c380c3a35cbfdee9ec22 Mon Sep 17 00:00:00 2001 From: Kyle MacLeod Date: Thu, 1 Dec 2022 13:02:27 -0500 Subject: [PATCH] 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 Change-Id: Iabc23aac20a35336cfe1b7f9c26b59fae49b69fb --- sysinv/sysinv/sysinv/sysinv/cert_mon/service.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/cert_mon/service.py b/sysinv/sysinv/sysinv/sysinv/cert_mon/service.py index 40e03db14c..dc61ff6a42 100644 --- a/sysinv/sysinv/sysinv/sysinv/cert_mon/service.py +++ b/sysinv/sysinv/sysinv/sysinv/cert_mon/service.py @@ -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()