Merge pull request #2771 from sergevanginderachter/apt-noninteractive-install

enforce no enteractiveness installing pkg with apt
pull/2772/head
Michael DeHaan 12 years ago
commit a63af4fada

@ -154,15 +154,18 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None, install_reco
else: else:
force_yes = '' force_yes = ''
cmd = "%s --option Dpkg::Options::=--force-confold -q -y %s install %s" % (APT_GET_CMD, force_yes, packages) if m.check_mode:
check_arg = '--simulate'
else:
check_arg = ''
cmd = "%s %s -y %s %s %s install %s" % (APT_ENVVARS, APT_GET_CMD, DPKG_OPTIONS, force_yes, check_arg, packages)
if default_release: if default_release:
cmd += " -t '%s'" % (default_release,) cmd += " -t '%s'" % (default_release,)
if not install_recommends: if not install_recommends:
cmd += " --no-install-recommends" cmd += " --no-install-recommends"
if m.check_mode:
m.exit_json(changed=True)
rc, out, err = m.run_command(cmd) rc, out, err = m.run_command(cmd)
if rc: if rc:
m.fail_json(msg="'apt-get install %s' failed: %s" % (packages, err)) m.fail_json(msg="'apt-get install %s' failed: %s" % (packages, err))

Loading…
Cancel
Save