[LORAX] Remove some env variables (#907692)

Vratislav Podzimek vpodzime at redhat.com
Fri Feb 15 10:18:53 UTC 2013


On Thu, 2013-02-14 at 16:19 -0800, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
> 
> Some package scripts may call utilities using dbus. Since this is just a
> chroot that will fail. This unsets DESKTOP and DBUS_SESSION_BUS_ADDRESS
> to keep them from crashing.
> ---
>  src/pylorax/__init__.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
> index e1c0069..3eff6e8 100644
> --- a/src/pylorax/__init__.py
> +++ b/src/pylorax/__init__.py
> @@ -121,6 +121,10 @@ class Lorax(BaseLoraxClass):
>          # so we have to add it ourselves
>          os.environ["PATH"] = "{0}:/sbin:/usr/sbin".format(os.environ["PATH"])
>  
> +        # remove some environmental variables that can cause problems with package scripts
> +        env_remove = ('DISPLAY', 'DBUS_SESSION_BUS_ADDRESS')
> +        [os.environ.pop(k) for k in env_remove if k in os.environ]
> +
Looks good to me. Interesting list comprehension usage. :)
 
-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list