mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Correct yum and dnf autoremove behavior (#47902)
* Correct yum and dnf autoremove behavior Sanity check args passed to autoremove Fixes #47184 Signed-off-by: Adam Miller <admiller@redhat.com> * fix docs Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
14037443de
commit
1c777976c5
4 changed files with 21 additions and 8 deletions
|
@ -41,8 +41,9 @@ options:
|
|||
state:
|
||||
description:
|
||||
- Whether to install (C(present), C(latest)), or remove (C(absent)) a package.
|
||||
- Default is C(None), however in effect the default action is C(present) unless the C(autoremove) option is
|
||||
enabled for this module, then C(absent) is inferred.
|
||||
choices: ['absent', 'present', 'installed', 'removed', 'latest']
|
||||
default: "present"
|
||||
|
||||
enablerepo:
|
||||
description:
|
||||
|
@ -1041,11 +1042,6 @@ class DnfModule(YumDnf):
|
|||
msg="Autoremove requires dnf>=2.0.1. Current dnf version is %s" % dnf.__version__,
|
||||
results=[],
|
||||
)
|
||||
if self.state not in ["absent", None]:
|
||||
self.module.fail_json(
|
||||
msg="Autoremove should be used alone or with state=absent",
|
||||
results=[],
|
||||
)
|
||||
|
||||
if self.update_cache and not self.names and not self.list:
|
||||
self.base = self._base(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue