mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
* pacman: don't always return changed w/ update_cache
This used to be the behavior before the recent refactoring. [1]
Allows the following to return changed only when packages were upgraded:
- pacman:
update_cache: yes
upgrade: yes
And the following to return changed only when the foo package wasn't at
the latest version:
- pacman:
name: foo
state: latest
update_cache: yes
[1] https://github.com/ansible-collections/community.general/pull/3907
* Update changelogs/fragments/4318-pacman-restore-old-changed-behavior.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cc8151f209
)
Co-authored-by: Evangelos Foutras <evangelos@foutrelis.com>
This commit is contained in:
parent
d4740ff387
commit
06980d8239
2 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
||||||
|
bugfixes:
|
||||||
|
- pacman - when the ``update_cache`` option is combined with another option
|
||||||
|
such as ``upgrade``, report ``changed`` based on the actions performed by
|
||||||
|
the latter option. This was the behavior in community.general 4.4.0 and before.
|
||||||
|
In community.general 4.5.0, a task combining these options would always
|
||||||
|
report ``changed``
|
||||||
|
(https://github.com/ansible-collections/community.general/pull/4318).
|
||||||
|
|
||||||
|
known_issues:
|
||||||
|
- pacman - ``update_cache`` cannot differentiate between up to date and
|
||||||
|
outdated package lists and will report ``changed`` in both situations
|
||||||
|
(https://github.com/ansible-collections/community.general/pull/4318).
|
|
@ -271,6 +271,12 @@ class Pacman(object):
|
||||||
if not (self.m.params["name"] or self.m.params["upgrade"]):
|
if not (self.m.params["name"] or self.m.params["upgrade"]):
|
||||||
self.success()
|
self.success()
|
||||||
|
|
||||||
|
# Avoid shadowing lack of changes in the following stages
|
||||||
|
# so that update_cache: yes doesn't always return changed
|
||||||
|
# TODO: remove this when update_cache is tweaked to report its real
|
||||||
|
# changed status (i.e. no changed if package lists were up to date)
|
||||||
|
self.changed = False
|
||||||
|
|
||||||
self.inventory = self._build_inventory()
|
self.inventory = self._build_inventory()
|
||||||
if self.m.params["upgrade"]:
|
if self.m.params["upgrade"]:
|
||||||
self.upgrade()
|
self.upgrade()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue