[LORAX] Remove some env variables (#907692)

Brian C. Lane bcl at redhat.com
Fri Feb 15 00:19:12 UTC 2013


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]
+
         self._configured = True
 
     def init_stream_logging(self):
-- 
1.8.1



More information about the anaconda-patches mailing list