]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: move _deploy_cephadm_binary to serve.py
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 6 Jan 2021 13:48:04 +0000 (14:48 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 11 Jan 2021 13:59:53 +0000 (14:59 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 9ce330d33ab68ed444da2c02aacc50d2ddb6c3f8..8a22a42e1dc9c3cb934d610c442e4e14552ad371 100644 (file)
@@ -1896,17 +1896,6 @@ To check that the host is reachable:
                 deps.append(dd.name())
         return sorted(deps)
 
-    def _deploy_cephadm_binary(self, host: str) -> bool:
-        # Use tee (from coreutils) to create a copy of cephadm on the target machine
-        self.log.info(f"Deploying cephadm binary to {host}")
-        with self._remote_connection(host) as tpl:
-            conn, _connr = tpl
-            _out, _err, code = remoto.process.check(
-                conn,
-                ['tee', '-', '/var/lib/ceph/{}/cephadm'.format(self._cluster_fsid)],
-                stdin=self._cephadm.encode('utf-8'))
-        return code == 0
-
     @forall_hosts
     def _remove_daemons(self, name: str, host: str) -> str:
         return CephadmServe(self)._remove_daemon(name, host)
index 0974728ac3d9bbdf635e614bda901b22f143b15b..cfd40dce4dbc0a73503ff2b01f3426dc8837e0ac 100644 (file)
@@ -757,7 +757,7 @@ class CephadmServe:
             if daemon_spec.daemon_type == 'cephadm-exporter':
                 if not reconfig:
                     assert daemon_spec.host
-                    deploy_ok = self.mgr._deploy_cephadm_binary(daemon_spec.host)
+                    deploy_ok = self._deploy_cephadm_binary(daemon_spec.host)
                     if not deploy_ok:
                         msg = f"Unable to deploy the cephadm binary to {daemon_spec.host}"
                         self.log.warning(msg)
@@ -1012,3 +1012,14 @@ class CephadmServe:
         if code:
             return f"Host {host} failed to login to {url} as {username} with given password"
         return None
+
+    def _deploy_cephadm_binary(self, host: str) -> bool:
+        # Use tee (from coreutils) to create a copy of cephadm on the target machine
+        self.log.info(f"Deploying cephadm binary to {host}")
+        with self.mgr._remote_connection(host) as tpl:
+            conn, _connr = tpl
+            _out, _err, code = remoto.process.check(
+                conn,
+                ['tee', '-', '/var/lib/ceph/{}/cephadm'.format(self.mgr._cluster_fsid)],
+                stdin=self.mgr._cephadm.encode('utf-8'))
+        return code == 0
index c296ccdbadaafda118bd6422dd024f100f4e5d3f..c8a9715983e52beb8533953cba3b5b78afd29abc 100644 (file)
@@ -576,7 +576,7 @@ class TestCephadm(object):
             (ServiceSpec('cephadm-exporter'), CephadmOrchestrator.add_cephadm_exporter),
         ]
     )
-    @mock.patch("cephadm.module.CephadmOrchestrator._deploy_cephadm_binary", _deploy_cephadm_binary('test'))
+    @mock.patch("cephadm.serve.CephadmServe._deploy_cephadm_binary", _deploy_cephadm_binary('test'))
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
     @mock.patch("cephadm.services.cephadmservice.RgwService.create_realm_zonegroup_zone", lambda _, __, ___: None)
     def test_daemon_add(self, spec: ServiceSpec, meth, cephadm_module):
@@ -743,7 +743,7 @@ class TestCephadm(object):
             (ServiceSpec('cephadm-exporter'), CephadmOrchestrator.apply_cephadm_exporter),
         ]
     )
-    @mock.patch("cephadm.module.CephadmOrchestrator._deploy_cephadm_binary", _deploy_cephadm_binary('test'))
+    @mock.patch("cephadm.serve.CephadmServe._deploy_cephadm_binary", _deploy_cephadm_binary('test'))
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
     @mock.patch("cephadm.services.cephadmservice.RgwService.create_realm_zonegroup_zone", lambda _, __, ___: None)
     def test_apply_save(self, spec: ServiceSpec, meth, cephadm_module: CephadmOrchestrator):