summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2024-09-23 09:33:38 +0200
committerGitHub <noreply@github.com>2024-09-23 09:33:38 +0200
commitaa24e97435433d08eb0b4cb69a2eaab8bae3a2ff (patch)
tree13a3627ce23ab6f88c6f67cddb93f9aa65abd70f
parentDo not convert floats to ints when there is truncation (#83864) (diff)
downloadansible-aa24e97435433d08eb0b4cb69a2eaab8bae3a2ff.tar.xz
ansible-aa24e97435433d08eb0b4cb69a2eaab8bae3a2ff.zip
dnf5: re-introduce ``state: installed`` alias (#83961)
Fixes #83960
-rw-r--r--changelogs/fragments/83960-dnf5-state-installed-fix.yml2
-rw-r--r--lib/ansible/modules/dnf5.py4
-rw-r--r--test/integration/targets/dnf/tasks/repo.yml2
3 files changed, 5 insertions, 3 deletions
diff --git a/changelogs/fragments/83960-dnf5-state-installed-fix.yml b/changelogs/fragments/83960-dnf5-state-installed-fix.yml
new file mode 100644
index 0000000000..a99d705d0a
--- /dev/null
+++ b/changelogs/fragments/83960-dnf5-state-installed-fix.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - "dnf5 - re-introduce the ``state: installed`` alias to ``state: present`` (https://github.com/ansible/ansible/issues/83960)"
diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py
index e3ef4a564d..6ce15a047a 100644
--- a/lib/ansible/modules/dnf5.py
+++ b/lib/ansible/modules/dnf5.py
@@ -655,7 +655,7 @@ class Dnf5Module(YumDnf):
results = []
if self.names == ["*"] and self.state == "latest":
goal.add_rpm_upgrade(settings)
- elif self.state in {"install", "present", "latest"}:
+ elif self.state in {"installed", "present", "latest"}:
upgrade = self.state == "latest"
for spec in self.names:
if is_newer_version_installed(base, spec):
@@ -688,7 +688,7 @@ class Dnf5Module(YumDnf):
if transaction.get_problems():
failures = []
for log_event in transaction.get_resolve_logs():
- if log_event.get_problem() == libdnf5.base.GoalProblem_NOT_FOUND and self.state in {"install", "present", "latest"}:
+ if log_event.get_problem() == libdnf5.base.GoalProblem_NOT_FOUND and self.state in {"installed", "present", "latest"}:
# NOTE dnf module compat
failures.append("No package {} available.".format(log_event.get_spec()))
else:
diff --git a/test/integration/targets/dnf/tasks/repo.yml b/test/integration/targets/dnf/tasks/repo.yml
index cabb8da929..6ab8fa1a3b 100644
--- a/test/integration/targets/dnf/tasks/repo.yml
+++ b/test/integration/targets/dnf/tasks/repo.yml
@@ -2,7 +2,7 @@
- name: Install dinginessentail-1.0-1
dnf:
name: dinginessentail-1.0-1
- state: present
+ state: installed
register: dnf_result
- name: Check dinginessentail with rpm