mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix recurse delete. Add force update_cache feature.
This commit is contained in:
parent
62e8f46390
commit
3956549e6c
1 changed files with 22 additions and 16 deletions
|
@ -60,7 +60,9 @@ options:
|
|||
|
||||
force:
|
||||
description:
|
||||
- Force remove package, without any checks.
|
||||
- When removing package - force remove package, without any
|
||||
checks. When update_cache - force redownload repo
|
||||
databases.
|
||||
required: false
|
||||
default: no
|
||||
choices: ["yes", "no"]
|
||||
|
@ -149,7 +151,12 @@ def query_package(module, pacman_path, name, state="present"):
|
|||
|
||||
|
||||
def update_package_db(module, pacman_path):
|
||||
cmd = "%s -Sy" % (pacman_path)
|
||||
if module.params["force"]:
|
||||
args = "Syy"
|
||||
else:
|
||||
args = "Sy"
|
||||
|
||||
cmd = "%s -%s" % (pacman_path, args)
|
||||
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
|
||||
|
||||
if rc == 0:
|
||||
|
@ -175,14 +182,13 @@ def upgrade(module, pacman_path):
|
|||
module.exit_json(changed=False, msg='Nothing to upgrade')
|
||||
|
||||
def remove_packages(module, pacman_path, packages):
|
||||
if module.params["recurse"] or module.params["force"]:
|
||||
if module.params["recurse"]:
|
||||
args = "Rs"
|
||||
else:
|
||||
args = "R"
|
||||
|
||||
def remove_packages(module, pacman_path, packages):
|
||||
if module.params["force"]:
|
||||
args = "Rdd"
|
||||
if module.params["recurse"] and module.params["force"]:
|
||||
args = "Rdds"
|
||||
else:
|
||||
args = "R"
|
||||
|
||||
|
|
Loading…
Reference in a new issue