55from pytest import Item
66from pyhelper_utils .shell import run_command
77
8- from utilities .exceptions import InvalidArguments
8+ from utilities .exceptions import InvalidArgumentsError
99from utilities .infra import get_rhods_csv_version , get_oc_image_info , generate_openshift_pull_secret_file
1010
1111BASE_DIRECTORY_NAME = "must-gather-collected"
@@ -22,7 +22,7 @@ def get_base_dir() -> str:
2222
2323def set_must_gather_collector_values () -> dict [str , str ]:
2424 py_config ["must_gather_collector" ] = {
25- "must_gather_base_directory" : f" { get_base_dir ()} { BASE_DIRECTORY_NAME } " ,
25+ "must_gather_base_directory" : os . path . join ( get_base_dir (), BASE_DIRECTORY_NAME ) ,
2626 }
2727 return py_config ["must_gather_collector" ]
2828
@@ -82,7 +82,7 @@ def run_must_gather(
8282 namespaces_dict : dict [str , str ] | None = None ,
8383) -> str :
8484 if component_name and namespaces_dict :
85- raise InvalidArguments ("component name and namespaces can't be passed together" )
85+ raise InvalidArgumentsError ("component name and namespaces can't be passed together" )
8686
8787 must_gather_command = "oc adm must-gather"
8888 if target_dir :
@@ -117,12 +117,16 @@ def run_must_gather(
117117
118118
119119def get_must_gather_image_info (architecture : str = "linux/amd64" ) -> str :
120- csv_version = get_rhods_csv_version ()
121- must_gather_image_manifest = f"quay.io/modh/must-gather:rhoai-{ csv_version .major } .{ csv_version .minor } "
122- image_info = get_oc_image_info (
123- image = must_gather_image_manifest , architecture = architecture , pull_secret = generate_openshift_pull_secret_file ()
124- )
125- return f"quay.io/modh/must-gather@{ image_info ['digest' ]} "
120+ try :
121+ csv_version = get_rhods_csv_version ()
122+ must_gather_image_manifest = f"quay.io/modh/must-gather:rhoai-{ csv_version .major } .{ csv_version .minor } "
123+ pull_secret = generate_openshift_pull_secret_file ()
124+ image_info = get_oc_image_info (
125+ image = must_gather_image_manifest , architecture = architecture , pull_secret = pull_secret
126+ )
127+ return f"quay.io/modh/must-gather@{ image_info ['digest' ]} "
128+ except Exception as exec :
129+ raise RuntimeError (f"Failed to retrieve must-gather image info: { str (exec )} " ) from exec
126130
127131
128132def collect_rhoai_must_gather (
0 commit comments