]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: use get_foreign_ceph_option() instead of 'config get' mon command
authorSage Weil <sage@newdream.net>
Tue, 16 Feb 2021 23:05:37 +0000 (18:05 -0500)
committerSage Weil <sage@newdream.net>
Wed, 17 Feb 2021 17:27:58 +0000 (12:27 -0500)
Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/tests/__init__.py

index c2737505b3ff3178436f390526c19fb3355f7c86..5d90ac542f073654545681a5404935412c87130e 100644 (file)
@@ -1136,12 +1136,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
                 daemon_type == 'nfs' or \
                 daemon_type == 'iscsi':
             # get container image
-            ret, image, err = self.check_mon_command({
-                'prefix': 'config get',
-                'who': utils.name_to_config_section(daemon_name),
-                'key': 'container_image',
-            })
-            image = image.strip()
+            image = str(self.get_foreign_ceph_option(
+                utils.name_to_config_section(daemon_name),
+                'container_image'
+            )).strip()
         elif daemon_type == 'prometheus':
             image = self.container_image_prometheus
         elif daemon_type == 'grafana':
index 93b48b5d3ca22f7dab4e08d3983a0b2c47748a14..9fb9ffc324eedd2d5b8085284628f183aa84e36d 100644 (file)
@@ -471,11 +471,7 @@ class CephadmServe:
 
         public_network = None
         if service_type == 'mon':
-            ret, out, err = self.mgr.check_mon_command({
-                'prefix': 'config get',
-                'who': 'mon',
-                'key': 'public_network',
-            })
+            out = str(self.mgr.get_foreign_ceph_option('mon', 'public_network'))
             if '/' in out:
                 public_network = out.strip()
                 self.log.debug('mon public_network is %s' % public_network)
index 8afdbe32e1c0add42d0b1b46e78b22a96a2431a6..d4ab4d52de6fd8ad5bdb923ef0cd9ca32a461959 100644 (file)
@@ -147,6 +147,15 @@ if 'UNITTEST' in os.environ:
 
             res.complete(0, outb, '')
 
+        def _ceph_get_foreign_option(self, entity, name):
+            who = entity.split('.')
+            whos = ['global'] + ['.'.join(who[:i+1]) for i in range(len(who))]
+            for attepmt in reversed(whos):
+                val = self.mock_store_get('config', f'{attepmt}/{name}', None)
+                if val is not None:
+                    return val
+            return None
+
         def assert_issued_mon_command(self, command):
             assert command in self._mon_commands_sent, self._mon_commands_sent