]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/ssh: move entity name munging into a helper
authorSage Weil <sage@redhat.com>
Wed, 6 Nov 2019 19:27:54 +0000 (13:27 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Dec 2019 21:35:35 +0000 (15:35 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/ssh/module.py

index 58088bcd2dd1d5c70084ca992f37ad4d92c13cc6..6c73e505a8efa15beaf257ae077d8e60c4453a3e 100644 (file)
@@ -69,6 +69,15 @@ except ImportError:
 #  - bring over some of the protections from ceph-deploy that guard against
 #    multiple bootstrapping / initialization
 
+def _name_to_entity_name(name):
+    """
+    Map from service names to ceph entity names (as seen in config)
+    """
+    if name.startswith('rgw.') or name.startswith('rbd-mirror'):
+        return 'client.' + name
+    else:
+        return name
+
 
 class AsyncCompletion(orchestrator.Completion):
     def __init__(self,
@@ -563,11 +572,9 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator):
 
         try:
             # get container image
-            if entity.startswith('rgw.') or entity.startswith('rbd-mirror'):
-                entity = 'client.' + entity
             ret, image, err = self.mon_command({
                 'prefix': 'config get',
-                'who': entity,
+                'who': _name_to_entity_name(entity),
                 'key': 'container_image',
             })
             image = image.strip()