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

https://github.com/rpm-software-management/dnf5/pull/607
pull/81203/head
Martin Krizek 12 months ago committed by GitHub
parent eb19692f48
commit c3af71a2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Utilize gpg check provided internally by the ``transaction.run`` method as oppose to calling it manually.

@ -670,16 +670,15 @@ class Dnf5Module(YumDnf):
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()],

Loading…
Cancel
Save