Commit c09d4b1c by Michael DeHaan

Update apt module so that environment variables are set correctly since not…

Update apt module so that environment variables are set correctly since not going through shell.  Very sorry folks, it will be addressed.
parent 7f028c10
...@@ -138,7 +138,11 @@ import datetime ...@@ -138,7 +138,11 @@ import datetime
import fnmatch import fnmatch
# APT related constants # APT related constants
APT_ENVVARS = "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical" APT_ENV_VARS = dict(
DEBIAN_FRONTEND = 'noninteractive',
DEBIAN_PRIORITY = 'critical'
)
DPKG_OPTIONS = 'force-confdef,force-confold' DPKG_OPTIONS = 'force-confdef,force-confold'
APT_GET_ZERO = "0 upgraded, 0 newly installed" APT_GET_ZERO = "0 upgraded, 0 newly installed"
APTITUDE_ZERO = "0 packages upgraded, 0 newly installed" APTITUDE_ZERO = "0 packages upgraded, 0 newly installed"
...@@ -260,7 +264,10 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None, ...@@ -260,7 +264,10 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None,
else: else:
check_arg = '' check_arg = ''
cmd = "%s %s -y %s %s %s install %s" % (APT_ENVVARS, APT_GET_CMD, dpkg_options, force_yes, check_arg, packages) for (k,v) in APT_ENV_VARS.iteritems():
os.environ[k] = v
cmd = "%s -y %s %s %s install %s" % (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,)
...@@ -292,7 +299,11 @@ def remove(m, pkgspec, cache, purge=False, ...@@ -292,7 +299,11 @@ def remove(m, pkgspec, cache, purge=False,
purge = '--purge' purge = '--purge'
else: else:
purge = '' purge = ''
cmd = "%s %s -q -y %s %s remove %s" % (APT_ENVVARS, APT_GET_CMD, dpkg_options, purge, packages)
for (k,v) in APT_ENV_VARS.iteritems():
os.environ[k] = v
cmd = "%s -q -y %s %s remove %s" % (APT_GET_CMD, dpkg_options, purge, packages)
if m.check_mode: if m.check_mode:
m.exit_json(changed=True) m.exit_json(changed=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment