]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: make synchronous wrapper functions of the async functions in ssh.py
authorMelissa <li.melissa.kun@gmail.com>
Tue, 20 Jul 2021 23:11:29 +0000 (19:11 -0400)
committerMelissa Li <li.melissa.kun@gmail.com>
Fri, 20 Aug 2021 18:27:45 +0000 (14:27 -0400)
Fixes: https://tracker.ceph.com/issues/44676
Signed-off-by: Melissa Li <li.melissa.kun@gmail.com>
src/pybind/mgr/cephadm/ssh.py

index 3751ae1750b5ccb28d5671fe9439420d3877ca97..67e14dd66f3573bbeb9ebd612dd3968ff9c8655f 100644 (file)
@@ -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: