From 603d91f9009dbdf638c723c5e728d9d18406222b Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 2 Nov 2021 07:42:01 +0100 Subject: [PATCH] dnf: add more specific error message for GPG check Fixes #76192 --- changelogs/fragments/76192-dnf-specific-gpg-error.yml | 2 ++ lib/ansible/modules/dnf.py | 2 +- test/integration/targets/dnf/tasks/gpg.yml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/76192-dnf-specific-gpg-error.yml diff --git a/changelogs/fragments/76192-dnf-specific-gpg-error.yml b/changelogs/fragments/76192-dnf-specific-gpg-error.yml new file mode 100644 index 00000000000000..9d52668cadf5fd --- /dev/null +++ b/changelogs/fragments/76192-dnf-specific-gpg-error.yml @@ -0,0 +1,2 @@ +minor_changes: + - dnf - add more specific error message for GPG validation (https://github.com/ansible/ansible/issues/76192) diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py index 83d2825789089e..91ebcdddd331c2 100644 --- a/lib/ansible/modules/dnf.py +++ b/lib/ansible/modules/dnf.py @@ -1298,7 +1298,7 @@ def ensure(self): fail = True if fail: - msg = 'Failed to validate GPG signature for {0}'.format(package) + msg = 'Failed to validate GPG signature for {0}: {1}'.format(package, gpgerr) self.module.fail_json(msg) if self.download_only: diff --git a/test/integration/targets/dnf/tasks/gpg.yml b/test/integration/targets/dnf/tasks/gpg.yml index 184270a0b363af..ab789ff2a734a0 100644 --- a/test/integration/targets/dnf/tasks/gpg.yml +++ b/test/integration/targets/dnf/tasks/gpg.yml @@ -57,6 +57,7 @@ that: - res is failed - "'Failed to validate GPG signature' in res.msg" + - "'is not signed' in res.msg" always: - name: Remove rpm-sign (and test package if it got installed)