From 5225fccc6ddc9366c9939fad7c69799aee446870 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 25 Nov 2019 11:18:09 -0600 Subject: [PATCH] mgr/ssh: 'ssh {check,prepare}-host ' Signed-off-by: Sage Weil --- src/pybind/mgr/ssh/module.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 2871f92e1a3..540d47eb027 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -520,6 +520,28 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): def _get_user(self): return 0, self.ssh_user, '' + @orchestrator._cli_read_command( + 'ssh check-host', + 'name=host,type=CephString', + 'Check whether we can access and manage a remote host') + def _check_host(self, host): + out, err, code = self._run_ceph_daemon(host, '', 'check-host', [], + error_ok=True, no_fsid=True) + if code: + return 1, '', err + return 0, 'host ok', err + + @orchestrator._cli_write_command( + 'ssh prepare-host', + 'name=host,type=CephString', + 'Try to prepare a host for remote management') + def _prepare_host(self, host): + out, err, code = self._run_ceph_daemon(host, '', 'prepare-host', [], + error_ok=True, no_fsid=True) + if code: + return 1, '', err + return 0, 'host ok', err + def _get_connection(self, host): """ Setup a connection for running commands on remote host. -- 2.39.5