diff --git a/tmt/steps/prepare/artifact/providers/__init__.py b/tmt/steps/prepare/artifact/providers/__init__.py index 9bf810d51a..206ba0bce9 100644 --- a/tmt/steps/prepare/artifact/providers/__init__.py +++ b/tmt/steps/prepare/artifact/providers/__init__.py @@ -218,7 +218,11 @@ def fetch_contents( raise tmt.utils.GeneralError( f"Unexpected error downloading '{artifact}'." ) from error - + if not downloaded_paths: + raise tmt.utils.GeneralError( + f"No artifacts were downloaded for provider '{self.raw_id}'. " + f"Verify the provider identifier is correct." + ) self.logger.info(f"Successfully downloaded '{len(downloaded_paths)}' artifacts.") return downloaded_paths diff --git a/tmt/steps/prepare/artifact/providers/copr_build.py b/tmt/steps/prepare/artifact/providers/copr_build.py index c960e5a562..1b67c7ff66 100644 --- a/tmt/steps/prepare/artifact/providers/copr_build.py +++ b/tmt/steps/prepare/artifact/providers/copr_build.py @@ -224,7 +224,12 @@ def contribute_to_shared_repo( shared_repo_dir: tmt.utils.Path, exclude_patterns: Optional[list[tmt.utils.Pattern[str]]] = None, ) -> None: - guest.execute( - ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") - ) + try: + guest.execute( + ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") + ) + except Exception: + self.logger.warning(f"No artifacts to contribute from '{source_path}'.") + return + self.logger.info(f"Contributed artifacts from '{source_path}' to '{shared_repo_dir}'.") diff --git a/tmt/steps/prepare/artifact/providers/file.py b/tmt/steps/prepare/artifact/providers/file.py index 326b82ac4c..6869399e3e 100644 --- a/tmt/steps/prepare/artifact/providers/file.py +++ b/tmt/steps/prepare/artifact/providers/file.py @@ -134,7 +134,12 @@ def contribute_to_shared_repo( shared_repo_dir: tmt.utils.Path, exclude_patterns: Optional[list[tmt.utils.Pattern[str]]] = None, ) -> None: - guest.execute( - ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") - ) + try: + guest.execute( + ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") + ) + except Exception: + self.logger.warning(f"No artifacts to contribute from '{source_path}'.") + return + self.logger.info(f"Contributed artifacts from '{source_path}' to '{shared_repo_dir}'.") diff --git a/tmt/steps/prepare/artifact/providers/koji.py b/tmt/steps/prepare/artifact/providers/koji.py index 66d44fbb87..a3ff56cb72 100644 --- a/tmt/steps/prepare/artifact/providers/koji.py +++ b/tmt/steps/prepare/artifact/providers/koji.py @@ -185,9 +185,14 @@ def contribute_to_shared_repo( shared_repo_dir: tmt.utils.Path, exclude_patterns: Optional[list[tmt.utils.Pattern[str]]] = None, ) -> None: - guest.execute( - ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") - ) + try: + guest.execute( + ShellScript(f"cp {quote(str(source_path))}/*.rpm {quote(str(shared_repo_dir))}") + ) + except Exception: + self.logger.warning(f"No artifacts to contribute from '{source_path}'.") + return + self.logger.info(f"Contributed artifacts from '{source_path}' to '{shared_repo_dir}'.") def make_rpm_artifact(self, rpm_meta: dict[str, Any]) -> ArtifactInfo: