- Improve set_systemd_services_states logging - [IPU 7 -> 8] Fix detection of bootable device on RAID - Fix detection of valid sshd config with internal-sftp subsystem in Leapp - Handle a false positive GPG check error when TargetUserSpaceInfo is missing - Fix failing "update-ca-trust" command caused by missing util-linux package - Improve report when a system is unsupported - Fix handling of versions in RHUI configuration for ELS and SAP upgrades - Add missing RHUI GCP config info for RHEL for SAP - Resolves: RHEL-33902, RHEL-30573, RHEL-43978, RHEL-39046, RHEL-39047, RHEL-39049
115 lines
5.2 KiB
Diff
115 lines
5.2 KiB
Diff
From caff3acea4f74a134a9f2f5714c08c8bf7b596f5 Mon Sep 17 00:00:00 2001
|
|
From: Petr Stodulka <pstodulk@redhat.com>
|
|
Date: Thu, 4 Jul 2024 10:52:43 +0200
|
|
Subject: [PATCH 91/92] GPG check: do not raise an error when
|
|
TargetUserSpaceInfo is missing
|
|
|
|
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
|
|
|
|
Signed-off-by: Petr Stodulka <pstodulk@redhat.com>
|
|
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
|
---
|
|
.../libraries/missinggpgkey.py | 17 ++++++++++-------
|
|
.../tests/component_test_missinggpgkey.py | 9 +++++----
|
|
2 files changed, 15 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py
|
|
index 4b93e741..32e4527b 100644
|
|
--- a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py
|
|
+++ b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py
|
|
@@ -7,7 +7,7 @@ import tempfile
|
|
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
|
|
@@ -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:
|
|
@@ -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
|
|
|
|
diff --git a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/tests/component_test_missinggpgkey.py b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/tests/component_test_missinggpgkey.py
|
|
index 6d3fa0b2..2cb142a0 100644
|
|
--- a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/tests/component_test_missinggpgkey.py
|
|
+++ b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/tests/component_test_missinggpgkey.py
|
|
@@ -2,7 +2,7 @@ import pytest
|
|
from six.moves.urllib.error import URLError
|
|
|
|
from leapp import reporting
|
|
-from leapp.exceptions import StopActorExecutionError
|
|
+from leapp.exceptions import StopActorExecution, StopActorExecutionError
|
|
from leapp.libraries.actor.missinggpgkey import process
|
|
from leapp.libraries.common.gpg import get_pubkeys_from_rpms
|
|
from leapp.libraries.common.testutils import create_report_mocked, CurrentActorMocked, logger_mocked, produce_mocked
|
|
@@ -191,12 +191,13 @@ def test_perform_missing_facts(monkeypatch, msgs):
|
|
monkeypatch.setattr(api, 'current_logger', logger_mocked())
|
|
# TODO: the gpg call should be mocked
|
|
|
|
- with pytest.raises(StopActorExecutionError):
|
|
+ with pytest.raises(StopActorExecution):
|
|
process()
|
|
# nothing produced
|
|
assert api.produce.called == 0
|
|
# not skipped by --nogpgcheck
|
|
- assert not api.current_logger.warnmsg
|
|
+ assert len(api.current_logger.warnmsg) == 1
|
|
+ assert "Missing TargetUserSpaceInfo data" in api.current_logger.warnmsg[0]
|
|
|
|
|
|
@suppress_deprecation(TMPTargetRepositoriesFacts)
|
|
@@ -280,7 +281,7 @@ def test_perform_missing_some_repo_facts(monkeypatch):
|
|
monkeypatch.setattr(reporting, 'create_report', create_report_mocked())
|
|
monkeypatch.setattr('leapp.libraries.common.gpg._gpg_show_keys', _gpg_show_keys_mocked)
|
|
|
|
- with pytest.raises(StopActorExecutionError):
|
|
+ with pytest.raises(StopActorExecution):
|
|
process()
|
|
assert api.produce.called == 0
|
|
assert reporting.create_report.called == 0
|
|
--
|
|
2.42.0
|
|
|