[RFC,v1,03/12] dts: fix remote session transferring files

Message ID 20240906132656.21729-4-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded
Delegated to: Juraj Linkeš
Headers
Series DTS external DPDK build and stats |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Juraj Linkeš Sept. 6, 2024, 1:26 p.m. UTC
From: Tomáš Ďurovec <tomas.durovec@pantheon.tech>

Fix parameters layout between source and destination
according to docs.

Signed-off-by: Tomáš Ďurovec <tomas.durovec@pantheon.tech>
---
 dts/framework/remote_session/remote_session.py | 14 ++++++++------
 dts/framework/remote_session/ssh_session.py    |  8 ++++----
 dts/framework/testbed_model/os_session.py      | 18 ++++++++++--------
 dts/framework/testbed_model/posix_session.py   |  8 ++++----
 4 files changed, 26 insertions(+), 22 deletions(-)
  

Patch

diff --git a/dts/framework/remote_session/remote_session.py b/dts/framework/remote_session/remote_session.py
index 8c580b070f..6ca8593c90 100644
--- a/dts/framework/remote_session/remote_session.py
+++ b/dts/framework/remote_session/remote_session.py
@@ -199,32 +199,34 @@  def is_alive(self) -> bool:
     def copy_from(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Copy a file from the remote Node to the local filesystem.
 
         Copy `source_file` from the remote Node associated with this remote session
-        to `destination_file` on the local filesystem.
+        to `destination_dir` on the local filesystem.
 
         Args:
             source_file: The file on the remote Node.
-            destination_file: A file or directory path on the local filesystem.
+            destination_dir: A dir path on the local filesystem, where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
     def copy_to(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Copy a file from local filesystem to the remote Node.
 
-        Copy `source_file` from local filesystem to `destination_file` on the remote Node
+        Copy `source_file` from local filesystem to `destination_dir` on the remote Node
         associated with this remote session.
 
         Args:
             source_file: The file on the local filesystem.
-            destination_file: A file or directory path on the remote Node.
+            destination_dir: A dir path on the remote Node, where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py
index 66f8176833..a756bfecef 100644
--- a/dts/framework/remote_session/ssh_session.py
+++ b/dts/framework/remote_session/ssh_session.py
@@ -106,18 +106,18 @@  def is_alive(self) -> bool:
     def copy_from(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_from`."""
-        self.session.get(str(destination_file), str(source_file))
+        self.session.get(str(source_file), str(destination_dir))
 
     def copy_to(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.copy_to`."""
-        self.session.put(str(source_file), str(destination_file))
+        self.session.put(str(source_file), str(destination_dir))
 
     def close(self) -> None:
         """Overrides :meth:`~.remote_session.RemoteSession.close`."""
diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py
index 79f56b289b..8928a47d6f 100644
--- a/dts/framework/testbed_model/os_session.py
+++ b/dts/framework/testbed_model/os_session.py
@@ -181,32 +181,34 @@  def join_remote_path(self, *args: str | PurePath) -> PurePath:
     def copy_from(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Copy a file from the remote node to the local filesystem.
 
         Copy `source_file` from the remote node associated with this remote
-        session to `destination_file` on the local filesystem.
+        session to `destination_dir` on the local filesystem.
 
         Args:
-            source_file: the file on the remote node.
-            destination_file: a file or directory path on the local filesystem.
+            source_file: The file on the remote node.
+            destination_dir: A dir path on the local filesystem, where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
     def copy_to(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Copy a file from local filesystem to the remote node.
 
-        Copy `source_file` from local filesystem to `destination_file`
+        Copy `source_file` from local filesystem to `destination_dir`
         on the remote node associated with this remote session.
 
         Args:
-            source_file: the file on the local filesystem.
-            destination_file: a file or directory path on the remote node.
+            source_file: The file on the local filesystem.
+            destination_dir: A dir path on the remote Node, where the `source_file`
+                will be saved.
         """
 
     @abstractmethod
diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py
index d279bb8b53..7f0b1f2036 100644
--- a/dts/framework/testbed_model/posix_session.py
+++ b/dts/framework/testbed_model/posix_session.py
@@ -88,18 +88,18 @@  def join_remote_path(self, *args: str | PurePath) -> PurePosixPath:
     def copy_from(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_from`."""
-        self.remote_session.copy_from(source_file, destination_file)
+        self.remote_session.copy_from(source_file, destination_dir)
 
     def copy_to(
         self,
         source_file: str | PurePath,
-        destination_file: str | PurePath,
+        destination_dir: str | PurePath,
     ) -> None:
         """Overrides :meth:`~.os_session.OSSession.copy_to`."""
-        self.remote_session.copy_to(source_file, destination_file)
+        self.remote_session.copy_to(source_file, destination_dir)
 
     def remove_remote_dir(
         self,