1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

minor fixes to apt

fixes #22124
This commit is contained in:
Brian Coca 2017-03-01 12:50:26 -05:00 committed by Brian Coca
parent 456b4ace7b
commit 7966beb6c9

View file

@ -108,7 +108,7 @@ options:
version_added: "1.6"
autoremove:
description:
- If C(yes), remove unused dependency packages for all module states except I(build-dep).
- If C(yes), remove unused dependency packages for all module states except I(build-dep). It can also be used as the only option.
required: false
default: no
choices: [ "yes", "no" ]
@ -393,6 +393,7 @@ def expand_pkgspec_from_fnmatches(m, pkgspec, cache):
# a PR to add some sort of explicit regex matching:
# https://github.com/ansible/ansible-modules-core/issues/1258
new_pkgspec = []
if pkgspec:
for pkgspec_pattern in pkgspec:
pkgname_pattern, version = package_split(pkgspec_pattern)
@ -790,7 +791,7 @@ def main():
module = AnsibleModule(
argument_spec = dict(
state = dict(default='present', choices=['installed', 'latest', 'removed', 'absent', 'present', 'build-dep']),
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
update_cache = dict(aliases=['update-cache'], type='bool'),
cache_valid_time = dict(type='int', default=0),
purge = dict(default=False, type='bool'),
package = dict(default=None, aliases=['pkg', 'name'], type='list'),
@ -800,12 +801,12 @@ def main():
force = dict(default='no', type='bool'),
upgrade = dict(choices=['no', 'yes', 'safe', 'full', 'dist']),
dpkg_options = dict(default=DPKG_OPTIONS),
autoremove = dict(type='bool', default=False, aliases=['autoclean']),
autoremove = dict(type='bool', aliases=['autoclean']),
only_upgrade = dict(type='bool', default=False),
allow_unauthenticated = dict(default='no', aliases=['allow-unauthenticated'], type='bool'),
),
mutually_exclusive = [['package', 'upgrade', 'deb']],
required_one_of = [['package', 'upgrade', 'update_cache', 'deb']],
required_one_of = [['package', 'upgrade', 'update_cache', 'deb', 'autoremove']],
supports_check_mode = True
)
@ -911,6 +912,7 @@ def main():
packages = p['package']
latest = p['state'] == 'latest'
if packages:
for package in packages:
if package.count('=') > 1:
module.fail_json(msg="invalid package spec: %s" % package)