From: Melissa Date: Tue, 20 Jul 2021 23:11:29 +0000 (-0400) Subject: mgr/cephadm: make synchronous wrapper functions of the async functions in ssh.py X-Git-Tag: v17.1.0~1051^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2873aeeb954e496313c48f332382efebe8f21d0e;p=ceph.git mgr/cephadm: make synchronous wrapper functions of the async functions in ssh.py Fixes: https://tracker.ceph.com/issues/44676 Signed-off-by: Melissa Li --- diff --git a/src/pybind/mgr/cephadm/ssh.py b/src/pybind/mgr/cephadm/ssh.py index 3751ae1750b5..67e14dd66f35 100644 --- a/src/pybind/mgr/cephadm/ssh.py +++ b/src/pybind/mgr/cephadm/ssh.py @@ -117,6 +117,9 @@ class SSHManager: log_string.flush() asyncssh_logger.removeHandler(ch) + def remote_connection(self, *args: Any) -> "SSHClientConnection": + return self.mgr.event_loop.get_result(self._remote_connection(*args)) + async def _execute_command(self, host: str, cmd: List[str], @@ -140,6 +143,9 @@ class SSHManager: err = r.stderr.rstrip('\n') return out, err, r.returncode + def execute_command(self, *args: Any, **kwargs: Any) -> Tuple[str, str, int]: + return self.mgr.event_loop.get_result(self._execute_command(*args, **kwargs)) + async def _check_execute_command(self, host: str, cmd: List[str], @@ -154,6 +160,9 @@ class SSHManager: raise OrchestratorError(msg) return out + def check_execute_command(self, *args: Any, **kwargs: Any) -> str: + return self.mgr.event_loop.get_result(self._check_execute_command(*args, **kwargs)) + async def _write_remote_file(self, host: str, path: str, @@ -180,6 +189,9 @@ class SSHManager: logger.exception(msg) raise OrchestratorError(msg) + def write_remote_file(self, *args: Any, **kwargs: Any) -> None: + self.mgr.event_loop.get_result(self._write_remote_file(*args, **kwargs)) + def _reset_con(self, host: str) -> None: conn = self.cons.get(host) if conn: