]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ssh: keep inventory and service cache keys in sync
authorSage Weil <sage@redhat.com>
Mon, 4 Nov 2019 19:43:36 +0000 (13:43 -0600)
committerSage Weil <sage@redhat.com>
Wed, 6 Nov 2019 14:26:12 +0000 (08:26 -0600)
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 <sage@redhat.com>
src/pybind/mgr/ssh/module.py

index 661a8fac56267e8e478210d42397be95f3cccbcb..e276222afed512181fccc5deaf17f41fb5611655 100644 (file)
@@ -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.