From: Tomáš Ďurovec <tomas.duro...@pantheon.tech> Update remote session to clearly differentiate between local and remote paths. Local paths now accept OS-aware path objects, while remote paths handle OS-agnostic paths.
Signed-off-by: Tomáš Ďurovec <tomas.duro...@pantheon.tech> --- dts/framework/remote_session/remote_session.py | 6 +++--- dts/framework/remote_session/ssh_session.py | 6 +++--- dts/framework/testbed_model/os_session.py | 6 +++--- dts/framework/testbed_model/posix_session.py | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dts/framework/remote_session/remote_session.py b/dts/framework/remote_session/remote_session.py index 6ca8593c90..ce311e70b6 100644 --- a/dts/framework/remote_session/remote_session.py +++ b/dts/framework/remote_session/remote_session.py @@ -12,7 +12,7 @@ from abc import ABC, abstractmethod from dataclasses import InitVar, dataclass, field -from pathlib import PurePath +from pathlib import Path, PurePath from framework.config import NodeConfiguration from framework.exception import RemoteCommandExecutionError @@ -199,7 +199,7 @@ def is_alive(self) -> bool: def copy_from( self, source_file: str | PurePath, - destination_dir: str | PurePath, + destination_dir: str | Path, ) -> None: """Copy a file from the remote Node to the local filesystem. @@ -215,7 +215,7 @@ def copy_from( @abstractmethod def copy_to( self, - source_file: str | PurePath, + source_file: str | Path, destination_dir: str | PurePath, ) -> None: """Copy a file from local filesystem to the remote Node. diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py index a756bfecef..88a000912e 100644 --- a/dts/framework/remote_session/ssh_session.py +++ b/dts/framework/remote_session/ssh_session.py @@ -5,7 +5,7 @@ import socket import traceback -from pathlib import PurePath +from pathlib import Path, PurePath from fabric import Connection # type: ignore[import-untyped] from invoke.exceptions import ( # type: ignore[import-untyped] @@ -106,14 +106,14 @@ def is_alive(self) -> bool: def copy_from( self, source_file: str | PurePath, - destination_dir: str | PurePath, + destination_dir: str | Path, ) -> None: """Overrides :meth:`~.remote_session.RemoteSession.copy_from`.""" self.session.get(str(source_file), str(destination_dir)) def copy_to( self, - source_file: str | PurePath, + source_file: str | Path, destination_dir: str | PurePath, ) -> None: """Overrides :meth:`~.remote_session.RemoteSession.copy_to`.""" diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index 8928a47d6f..d24f44df10 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -25,7 +25,7 @@ from abc import ABC, abstractmethod from collections.abc import Iterable from ipaddress import IPv4Interface, IPv6Interface -from pathlib import PurePath +from pathlib import Path, PurePath from typing import Union from framework.config import Architecture, NodeConfiguration, NodeInfo @@ -181,7 +181,7 @@ def join_remote_path(self, *args: str | PurePath) -> PurePath: def copy_from( self, source_file: str | PurePath, - destination_dir: str | PurePath, + destination_dir: str | Path, ) -> None: """Copy a file from the remote node to the local filesystem. @@ -197,7 +197,7 @@ def copy_from( @abstractmethod def copy_to( self, - source_file: str | PurePath, + source_file: str | Path, destination_dir: str | PurePath, ) -> None: """Copy a file from local filesystem to the remote node. diff --git a/dts/framework/testbed_model/posix_session.py b/dts/framework/testbed_model/posix_session.py index 7f0b1f2036..0d8c5f91a6 100644 --- a/dts/framework/testbed_model/posix_session.py +++ b/dts/framework/testbed_model/posix_session.py @@ -13,7 +13,7 @@ import re from collections.abc import Iterable -from pathlib import PurePath, PurePosixPath +from pathlib import Path, PurePath, PurePosixPath from framework.config import Architecture, NodeInfo from framework.exception import DPDKBuildError, RemoteCommandExecutionError @@ -88,14 +88,14 @@ def join_remote_path(self, *args: str | PurePath) -> PurePosixPath: def copy_from( self, source_file: str | PurePath, - destination_dir: str | PurePath, + destination_dir: str | Path, ) -> None: """Overrides :meth:`~.os_session.OSSession.copy_from`.""" self.remote_session.copy_from(source_file, destination_dir) def copy_to( self, - source_file: str | PurePath, + source_file: str | Path, destination_dir: str | PurePath, ) -> None: """Overrides :meth:`~.os_session.OSSession.copy_to`.""" -- 2.43.0