2626 pwd ,
2727 rebase_path ,
2828)
29- from testplan .common .utils .process import (
30- execute_cmd ,
31- )
29+ from testplan .common .utils .process import execute_cmd
3230from testplan .common .utils .remote import (
3331 IS_WIN ,
3432 copy_cmd ,
@@ -734,23 +732,19 @@ def _fetch_results(self) -> None:
734732 self .logger .error (
735733 "%s not properly set up, skip fetch results stage" , self
736734 )
735+ return
737736 self .logger .debug ("Fetch results stage - %s" , self .ssh_cfg ["host" ])
738- try :
739- self ._transfer_data (
740- source = self ._remote_resource_runpath ,
741- remote_source = True ,
742- target = cast (Entity , self .parent ).runpath ,
743- exclude = self .cfg .fetch_runpath_exclude ,
744- )
745- if self .cfg .pull :
746- self ._pull_files ()
747- except Exception as exc :
748- self ._error_exec .append (exc )
749- self .logger .warning (
750- "While fetching result from remote resource [%s]: %s" ,
751- self ,
752- exc ,
753- )
737+ # check=False: a fetch failure (e.g. a source absent on the remote) is
738+ # tolerated and logged as (non-fatal), it does not abort teardown.
739+ self ._transfer_data (
740+ source = self ._remote_resource_runpath ,
741+ remote_source = True ,
742+ target = cast (Entity , self .parent ).runpath ,
743+ exclude = self .cfg .fetch_runpath_exclude ,
744+ check = False ,
745+ )
746+ if self .cfg .pull :
747+ self ._pull_files ()
754748
755749 def _clean_remote (self ) -> None :
756750 if self .cfg .clean_remote :
@@ -787,20 +781,13 @@ def _pull_files(self) -> None:
787781 makedirs (pull_dst )
788782
789783 for entry in self .cfg .pull :
790- try :
791- self ._transfer_data (
792- source = entry ,
793- remote_source = True ,
794- target = pull_dst ,
795- exclude = self .cfg .pull_exclude ,
796- )
797- except Exception as exc :
798- self ._error_exec .append (exc )
799- self .logger .warning (
800- "While fetching result from remote resource [%s]: %s" ,
801- self ,
802- exc ,
803- )
784+ self ._transfer_data (
785+ source = entry ,
786+ remote_source = True ,
787+ target = pull_dst ,
788+ exclude = self .cfg .pull_exclude ,
789+ check = False ,
790+ )
804791
805792 def _remote_sys_path (self ) -> List [str ]:
806793 sys_path : List [str ] = [cast (str , self ._testplan_import_path .remote )]
@@ -853,8 +840,9 @@ def _transfer_data(
853840 target : str ,
854841 remote_source : bool = False ,
855842 remote_target : bool = False ,
843+ check : bool = True ,
856844 ** copy_args : Any ,
857- ) -> None :
845+ ) -> Tuple [ int , Optional [ str ], Optional [ str ]] :
858846 if remote_source :
859847 source = self ._remote_copy_path (source )
860848 if remote_target :
@@ -864,11 +852,12 @@ def _transfer_data(
864852 source , target , port = self .ssh_cfg ["port" ], ** copy_args
865853 )
866854 with open (os .devnull , "w" ) as devnull :
867- execute_cmd (
855+ return execute_cmd (
868856 cmd ,
869857 "transfer data [..{}]" .format (os .path .basename (source )),
870858 stdout = devnull , # type: ignore[arg-type]
871859 logger = self .logger ,
860+ check = check ,
872861 )
873862
874863 def _check_remote_os (self ) -> None :
0 commit comments