From cd002f9d61af7a6ad6f66db14c0d150b1e68e2a6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 4 Nov 2019 13:43:36 -0600 Subject: [PATCH] mgr/ssh: keep inventory and service cache keys in sync Our host list is implicitly defined as the set of keys for the inventory (and service) caches. Ensure they are in sync by unioning and inserting any missing items. Signed-off-by: Sage Weil --- src/pybind/mgr/ssh/module.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 661a8fac56267..e276222afed51 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -175,6 +175,15 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): self.service_cache = orchestrator.OutdatablePersistentDict( self, self._STORE_HOST_PREFIX + '.services') + # ensure the host lists are in sync + for h in set(self.inventory_cache.keys()) | set(self.service_cache.keys()): + if h not in self.inventory_cache: + self.log.debug('adding inventory item for %s' % h) + self.inventory_cache[h] = orchestrator.OutdatableData() + if h not in self.service_cache: + self.log.debug('adding service item for %s' % h) + self.service_cache[h] = orchestrator.OutdatableData() + def config_notify(self): """ This method is called whenever one of our config options is changed. -- 2.39.5