Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnf5: utilize automatic gpg check via transaction.run() #81144

Merged
merged 1 commit into from Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/dnf5-gpg-check-builtin.yml
@@ -0,0 +1,2 @@
minor_changes:
- Utilize gpg check provided internally by the ``transaction.run`` method as oppose to calling it manually.
9 changes: 4 additions & 5 deletions lib/ansible/modules/dnf5.py
Expand Up @@ -671,16 +671,15 @@ def run(self):
else:
transaction.download()
if not self.download_only:
if not self.disable_gpg_check and not transaction.check_gpg_signatures():
transaction.set_description("ansible dnf5 module")
result = transaction.run()
if result == libdnf5.base.Transaction.TransactionRunResult_ERROR_GPG_CHECK:
self.module.fail_json(
msg="Failed to validate GPG signatures: {}".format(",".join(transaction.get_gpg_signature_problems())),
failures=[],
rc=1,
)

transaction.set_description("ansible dnf5 module")
result = transaction.run()
if result != libdnf5.base.Transaction.TransactionRunResult_SUCCESS:
elif result != libdnf5.base.Transaction.TransactionRunResult_SUCCESS:
self.module.fail_json(
msg="Failed to install some of the specified packages",
failures=["{}: {}".format(transaction.transaction_result_to_string(result), log) for log in transaction.get_transaction_problems()],
Expand Down