Fixes for bcoca's review of #1916

pull/18777/head
Toshio Kuratomi 9 years ago committed by Matt Clay
parent c31a6fd23f
commit 7ae4bdadfc

@ -64,7 +64,7 @@ options:
description: description:
- Corresponds to the C(--no-install-recommends) option for I(apt). C(yes) installs recommended packages. C(no) does not install recommended packages. By default, Ansible will use the same defaults as the operating system. Suggested packages are never installed. - Corresponds to the C(--no-install-recommends) option for I(apt). C(yes) installs recommended packages. C(no) does not install recommended packages. By default, Ansible will use the same defaults as the operating system. Suggested packages are never installed.
required: false required: false
default: yes default: null
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
force: force:
description: description:
@ -339,7 +339,7 @@ def expand_pkgspec_from_fnmatches(m, pkgspec, cache):
return new_pkgspec return new_pkgspec
def install(m, pkgspec, cache, upgrade=False, default_release=None, def install(m, pkgspec, cache, upgrade=False, default_release=None,
install_recommends='default', force=False, install_recommends=None, force=False,
dpkg_options=expand_dpkg_options(DPKG_OPTIONS), dpkg_options=expand_dpkg_options(DPKG_OPTIONS),
build_dep=False): build_dep=False):
pkg_list = [] pkg_list = []
@ -385,10 +385,12 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None,
if default_release: if default_release:
cmd += " -t '%s'" % (default_release,) cmd += " -t '%s'" % (default_release,)
if install_recommends == 'no':
if install_recommends is False:
cmd += " -o APT::Install-Recommends=no" cmd += " -o APT::Install-Recommends=no"
elif install_recommends == 'yes': elif install_recommends is True:
cmd += " -o APT::Install-Recommends=yes" cmd += " -o APT::Install-Recommends=yes"
# install_recommends is None uses the OS default
rc, out, err = m.run_command(cmd) rc, out, err = m.run_command(cmd)
if rc: if rc:
@ -549,7 +551,7 @@ def main():
package = dict(default=None, aliases=['pkg', 'name'], type='list'), package = dict(default=None, aliases=['pkg', 'name'], type='list'),
deb = dict(default=None), deb = dict(default=None),
default_release = dict(default=None, aliases=['default-release']), default_release = dict(default=None, aliases=['default-release']),
install_recommends = dict(default='default', aliases=['install-recommends'], choices=['default', 'yes', 'no']), install_recommends = dict(default=None, aliases=['install-recommends'], type='bool'),
force = dict(default='no', type='bool'), force = dict(default='no', type='bool'),
upgrade = dict(choices=['no', 'yes', 'safe', 'full', 'dist']), upgrade = dict(choices=['no', 'yes', 'safe', 'full', 'dist']),
dpkg_options = dict(default=DPKG_OPTIONS) dpkg_options = dict(default=DPKG_OPTIONS)

Loading…
Cancel
Save