diff --git a/changelogs/fragments/80887-dnf5-api-change.yml b/changelogs/fragments/80887-dnf5-api-change.yml new file mode 100644 index 00000000000..c27d79d252e --- /dev/null +++ b/changelogs/fragments/80887-dnf5-api-change.yml @@ -0,0 +1,3 @@ +bugfixes: +- dnf5 - Update dnf5 module to handle API change for setting the download directory + (https://github.com/ansible/ansible/issues/80887) diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py index 53dd57d49b0..362a9a3d804 100644 --- a/lib/ansible/modules/dnf5.py +++ b/lib/ansible/modules/dnf5.py @@ -513,6 +513,8 @@ class Dnf5Module(YumDnf): conf.installroot = self.installroot conf.use_host_config = True # needed for installroot conf.cacheonly = self.cacheonly + if self.download_dir: + conf.destdir = self.download_dir base.setup() @@ -667,7 +669,7 @@ class Dnf5Module(YumDnf): if results: msg = "Check mode: No changes made, but would have if not in check mode" else: - transaction.download(self.download_dir or "") + transaction.download() if not self.download_only: if not self.disable_gpg_check and not transaction.check_gpg_signatures(): self.module.fail_json(