From 0061f37a2d152b410e0c0d6cdf502660683ad158 Mon Sep 17 00:00:00 2001 From: mhecko Date: Mon, 10 Jun 2024 14:47:48 +0200 Subject: [PATCH] provide more user-friendly error when failing to swap rhui clients --- .../libraries/userspacegen.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index dc93c9a03b..89111dcd8b 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -1220,7 +1220,20 @@ def setup_target_rhui_access_if_needed(context, indata): _apply_rhui_access_postinstall_tasks(context, setup_info) # Do a cleanup so there are not duplicit repoids - files_owned_by_clients = _query_rpm_for_pkg_files(context, indata.rhui_info.target_client_pkg_names) + try: + files_owned_by_clients = _query_rpm_for_pkg_files(context, indata.rhui_info.target_client_pkg_names) + except CalledProcessError as err: # We failed to rpm -qf PKG, the PKG is most likely not installed + api.current_logger().critical('Failed to query files owned by target RHUI clients (clients=%s). This is caused ' + 'by failing to install the target clients during the client-swap step.' + 'Full error: %s', indata.rhui_info.target_client_pkg_names, err) + + target_major = get_target_major_version() + plural_suffix = '' if len(indata.rhui_info.target_client_pkg_names) > 1 else 's' + client_rpms = ', '.join(indata.rhui_info.target_client_pkg_names) + msg = ('Could not find the RHEL {target_major} RHUI client rpm{plural_suffix} ({client_rpms})' + 'in the cloud provider\'s client repository.') + raise StopActorExecutionError(msg.format(target_major=target_major, plural_suffix=plural_suffix, + client_rpms=client_rpms)) for copy_task in setup_info.preinstall_tasks.files_to_copy_into_overlay: dest = get_copy_location_from_copy_in_task(context.base_dir, copy_task)