From 2873aeeb954e496313c48f332382efebe8f21d0e Mon Sep 17 00:00:00 2001
From: Melissa
Date: Tue, 20 Jul 2021 19:11:29 -0400
Subject: [PATCH] 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
---
src/pybind/mgr/cephadm/ssh.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/pybind/mgr/cephadm/ssh.py b/src/pybind/mgr/cephadm/ssh.py
index 3751ae1750b5c..67e14dd66f357 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:
--
2.39.5