From 9505f8c75d33825dad5f658b51d46418226d746e Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 19 Aug 2021 21:20:53 +0200 Subject: [PATCH] dnf: allow for download_only to be run without root (#75532) Fixes #75530 --- changelogs/fragments/75530-dnf-download_only-non-root.yml | 2 ++ lib/ansible/modules/dnf.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/75530-dnf-download_only-non-root.yml diff --git a/changelogs/fragments/75530-dnf-download_only-non-root.yml b/changelogs/fragments/75530-dnf-download_only-non-root.yml new file mode 100644 index 00000000000..b14b7129cd8 --- /dev/null +++ b/changelogs/fragments/75530-dnf-download_only-non-root.yml @@ -0,0 +1,2 @@ +minor_changes: + - dnf - allow for ``download_only`` to be run without root privileges (https://github.com/ansible/ansible/issues/75530) diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py index 6fddec3262d..770f2ca4e72 100644 --- a/lib/ansible/modules/dnf.py +++ b/lib/ansible/modules/dnf.py @@ -1348,7 +1348,7 @@ class DnfModule(YumDnf): else: # Note: base takes a long time to run so we want to check for failure # before running it. - if not dnf.util.am_i_root(): + if not self.download_only and not dnf.util.am_i_root(): self.module.fail_json( msg="This command has to be run under the root user.", results=[],