Skip to content

Commit

Permalink
GPG check: do not raise an error when TargetUserSpaceInfo is missing
Browse files Browse the repository at this point in the history
Previously, if the upgrade has been inhibited during
    TargetTransactionFactsCollectionPhase
usually because we could not create (for whatever reason) the target
userspace container, the actor checking rpm gpg keys failed with
the `Could not check for valid GPG keys` error. This has confused
many users as they couldn't know that this is impacted by the
problem described in an inhibitor that is below this error.

As it's for sure that the upgrade cannot continue when the target user
space container has not been created (the TargetUserSpaceInfo msg
is missing), we consider it safe to stop the gpg check here silently
just with a warning msg instead of raising the error - as this check
is important only in case we could actually upgrade.

All other possible raised errors are presereved.

jira: https://issues.redhat.com/browse/RHEL-30573
  • Loading branch information
pirat89 committed Jul 16, 2024
1 parent f822cb8 commit 5881e47
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from six.moves import urllib

from leapp import reporting
from leapp.exceptions import StopActorExecutionError
from leapp.exceptions import StopActorExecution, StopActorExecutionError
from leapp.libraries.common.config.version import get_target_major_version
from leapp.libraries.common.gpg import get_gpg_fp_from_file, get_path_to_gpg_certs, is_nogpgcheck_set
from leapp.libraries.stdlib import api
Expand Down Expand Up @@ -61,6 +61,15 @@ def _get_abs_file_path(target_userspace, file_url):


def _consume_data():
try:
target_userspace = next(api.consume(TargetUserSpaceInfo))
except StopIteration:
api.current_logger().warning(
'Missing TargetUserSpaceInfo data. The upgrade cannot continue'
'without this data, so skipping any other actions.'
)
raise StopActorExecution()

try:
used_target_repos = next(api.consume(UsedTargetRepositories)).repos
except StopIteration:
Expand All @@ -83,12 +92,6 @@ def _consume_data():
raise StopActorExecutionError(
'Could not check for valid GPG keys', details={'details': 'No TrustedGpgKeys facts'}
)
try:
target_userspace = next(api.consume(TargetUserSpaceInfo))
except StopIteration:
raise StopActorExecutionError(
'Could not check for valid GPG keys', details={'details': 'No TargetUserSpaceInfo facts'}
)

return used_target_repos, target_repos, trusted_gpg_keys, target_userspace

Expand Down

0 comments on commit 5881e47

Please sign in to comment.