~free.ekanayaka/landscape-client/use-smart-to-get-dpkg-arch

« back to all changes in this revision

Viewing changes to landscape/watchdog.py

  • Committer: Free Ekanayaka
  • Date: 2009-07-10 10:49:34 UTC
  • Revision ID: free.ekanayaka@canonical.com-20090710104934-7e0hrl0w5sn3mebn
Set LOGNAME and unset MAIL

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
        self._env = os.environ.copy()
90
90
        self._env["HOME"] = pwd_info.pw_dir
91
91
        self._env["USER"] = self.username
 
92
        self._env["LOGNAME"] = self.username
92
93
        self._verbose = verbose
93
94
        self._config = config
94
95
        self._process = None
513
514
 
514
515
 
515
516
def clean_environment():
516
 
    """Unset any environment variables that begin with DEBIAN_ or DEBCONF_.
 
517
    """Unset dangerous environment variables.
517
518
 
518
 
    We do this to avoid any problems when landscape-client is invoked from its
 
519
    In particular unsert all variables beginning with DEBIAN_ or DEBCONF_,
 
520
    to avoid any problems when landscape-client is invoked from its
519
521
    postinst script.  Some environment variables may be set which would affect
520
522
    *other* maintainer scripts which landscape-client invokes (via smart).
521
523
    """
522
524
    for key in os.environ.keys():
523
525
        if (key.startswith("DEBIAN_")
524
526
            or key.startswith("DEBCONF_")
525
 
            or key == "LANDSCAPE_ATTACHMENTS"):
 
527
            or key in ["LANDSCAPE_ATTACHMENTS", "MAIL"]):
526
528
            del os.environ[key]
527
529
 
528
530