saltstack/salt — pull request #3125 by fsniper (2013-01-03 09:47:03+00:00)
Title: Develop

In some cases, ubuntu forces you to set environment variables to force install or remove packages.

For instance if you do not set sudo password and would like to install sudo-ldap instead, ubuntu dpkg package refuses to remove sudo with this alert:

```
You have asked that the sudo package be removed,
but no root password has been set.
Without sudo, you may not be able to gain administrative privileges.

If you would prefer to access the root account with su(1)
or by logging in directly,
you must set a root password with "sudo passwd".

If you have arranged other means to access the root account,
and you are sure this is what you want,
you may bypass this check by setting an environment variable
(export SUDO_FORCE_REMOVE=yes).

Refusing to remove sudo.
```

So for installing sudo-ldap without setting a root password you have to set SUDO_FORCE_REMOVE environment variable.

Normally if you set an env dict in a state file this is passed through to modules as a kwargs. But it is not used in apt.py module.

Also I've changed hasbangs of the scripts to #!/usr/bin/env python for virtual environments.