From 0cc50e067346c357c5177677fba41993950ff044 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Wed, 28 Jun 2023 16:05:59 +0200 Subject: [PATCH] dnf5: enable now implemented cacheonly functionality (#81141) Note that this also fixes a traceback caused by backwards incompatible change in dnf5 where cacheonly was changed from bool to string: https://github.com/rpm-software-management/dnf5/pull/665/files#diff-ab65249ff7fccadfb2864b6826f6559f7f16fad43fd3bf2da0b4fe8db790d59aR179 --- changelogs/fragments/dnf5-cacheonly.yml | 2 ++ lib/ansible/modules/dnf5.py | 3 +-- test/integration/targets/dnf/tasks/main.yml | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/dnf5-cacheonly.yml diff --git a/changelogs/fragments/dnf5-cacheonly.yml b/changelogs/fragments/dnf5-cacheonly.yml new file mode 100644 index 00000000000000..b7e2d753fb23dc --- /dev/null +++ b/changelogs/fragments/dnf5-cacheonly.yml @@ -0,0 +1,2 @@ +minor_changes: + - dnf5 - enable now implemented ``cacheonly`` functionality diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py index 362a9a3d804f52..f1653881bea3e3 100644 --- a/lib/ansible/modules/dnf5.py +++ b/lib/ansible/modules/dnf5.py @@ -215,7 +215,6 @@ default: "no" cacheonly: description: - - This is currently no-op as dnf5 does not implement the feature. - Tells dnf to run entirely from system cache; does not download or update metadata. type: bool default: "no" @@ -512,7 +511,7 @@ def run(self): conf.clean_requirements_on_remove = self.autoremove conf.installroot = self.installroot conf.use_host_config = True # needed for installroot - conf.cacheonly = self.cacheonly + conf.cacheonly = "all" if self.cacheonly else "none" if self.download_dir: conf.destdir = self.download_dir diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml index b84e3389bcf1ca..059bf747c9a31e 100644 --- a/test/integration/targets/dnf/tasks/main.yml +++ b/test/integration/targets/dnf/tasks/main.yml @@ -74,4 +74,3 @@ when: - (ansible_distribution == 'Fedora' and ansible_distribution_major_version is version('23', '>=')) or (ansible_distribution in ['RedHat', 'CentOS'] and ansible_distribution_major_version is version('8', '>=')) - - not dnf5|default('false')