add force remove feature
This commit is contained in:
parent
ca1daba8bb
commit
d8d90ecb03
1 changed files with 18 additions and 0 deletions
|
@ -56,6 +56,14 @@ options:
|
||||||
choices: ["yes", "no"]
|
choices: ["yes", "no"]
|
||||||
version_added: "1.3"
|
version_added: "1.3"
|
||||||
|
|
||||||
|
force:
|
||||||
|
description:
|
||||||
|
- Force remove package, without any checks.
|
||||||
|
required: false
|
||||||
|
default: "no"
|
||||||
|
choices: ["yes", "no"]
|
||||||
|
version_added: "1.3"
|
||||||
|
|
||||||
update_cache:
|
update_cache:
|
||||||
description:
|
description:
|
||||||
- Whether or not to refresh the master package lists. This can be
|
- Whether or not to refresh the master package lists. This can be
|
||||||
|
@ -90,6 +98,9 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Run the equivalent of "pacman -Su" as a separate step
|
# Run the equivalent of "pacman -Su" as a separate step
|
||||||
- pacman: upgrade=yes
|
- pacman: upgrade=yes
|
||||||
|
|
||||||
|
# Run the equivalent of "pacman -Rdd", force remove package baz
|
||||||
|
- pacman: name=baz state=absent force=yes
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
@ -170,6 +181,12 @@ def remove_packages(module, packages):
|
||||||
else:
|
else:
|
||||||
args = "R"
|
args = "R"
|
||||||
|
|
||||||
|
def remove_packages(module, packages):
|
||||||
|
if module.params["force"]:
|
||||||
|
args = "Rdd"
|
||||||
|
else:
|
||||||
|
args = "R"
|
||||||
|
|
||||||
remove_c = 0
|
remove_c = 0
|
||||||
# Using a for loop incase of error, we can report the package that failed
|
# Using a for loop incase of error, we can report the package that failed
|
||||||
for package in packages:
|
for package in packages:
|
||||||
|
@ -244,6 +261,7 @@ def main():
|
||||||
name = dict(aliases=['pkg']),
|
name = dict(aliases=['pkg']),
|
||||||
state = dict(default='present', choices=['present', 'installed', "latest", 'absent', 'removed']),
|
state = dict(default='present', choices=['present', 'installed', "latest", 'absent', 'removed']),
|
||||||
recurse = dict(default='no', choices=BOOLEANS, type='bool'),
|
recurse = dict(default='no', choices=BOOLEANS, type='bool'),
|
||||||
|
force = dict(default='no', choices=BOOLEANS, type='bool'),
|
||||||
upgrade = dict(default='no', choices=BOOLEANS, type='bool'),
|
upgrade = dict(default='no', choices=BOOLEANS, type='bool'),
|
||||||
update_cache = dict(default='no', aliases=['update-cache'], choices=BOOLEANS, type='bool')),
|
update_cache = dict(default='no', aliases=['update-cache'], choices=BOOLEANS, type='bool')),
|
||||||
required_one_of = [['name', 'update_cache', 'upgrade']],
|
required_one_of = [['name', 'update_cache', 'upgrade']],
|
||||||
|
|
Loading…
Reference in a new issue