From baafcfc091d09f69ef51a9b1cd36ee2fc5169f83 Mon Sep 17 00:00:00 2001 From: Harlan Lieberman-Berg Date: Sat, 15 Aug 2015 11:40:00 +0200 Subject: [PATCH] Change behavior of apt.py around installing recommended packages. Closes #1189. This will cause the settings in Ansible to override the system settings. That will have no effect except on systems that have an out-of-Ansible configuration that disables automatic installation of recommended packages. Previously, ansible would use the OS default whenever install_recommends wasn't part of the playbook. This change will cause the Ansible default configuration setting of installing recommended packages to override the configuration files set on the OS for things installed through ansible, even when there is no install_recommends specified in the playbook. Because the OS default matches the Ansible default, this shouldn't have wide impact. --- packaging/os/apt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/os/apt.py b/packaging/os/apt.py index d99eb85ff7e..7198d934ca2 100755 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -231,7 +231,7 @@ def package_status(m, pkgname, version, cache, state): provided_packages = cache.get_providing_packages(pkgname) if provided_packages: is_installed = False - # when virtual package providing only one package, look up status of target package + # when virtual package providing only one package, look up status of target package if cache.is_virtual_package(pkgname) and len(provided_packages) == 1: package = provided_packages[0] installed, upgradable, has_files = package_status(m, package.name, version, cache, state='install') @@ -386,7 +386,9 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None, if default_release: cmd += " -t '%s'" % (default_release,) if not install_recommends: - cmd += " --no-install-recommends" + cmd += " -o APT::Install-Recommends=no" + else: + cmd += " -o APT::Install-Recommends=yes" rc, out, err = m.run_command(cmd) if rc: