diff --git a/LCS/PyCommon/dbcredentials.py b/LCS/PyCommon/dbcredentials.py index 7fb06c209d811cf7cfc004c0a51e647b35552394..05f89b60fdfe72cf45db3dccacc956219272bbe9 100644 --- a/LCS/PyCommon/dbcredentials.py +++ b/LCS/PyCommon/dbcredentials.py @@ -20,12 +20,19 @@ # $Id$ from glob import glob -from os import environ +import os +import pwd from ConfigParser import SafeConfigParser, NoSectionError, DuplicateSectionError from optparse import OptionGroup __all__ = ["DBCredentials", "options_group", "parse_options"] +# obtain the environment, and add USER and HOME if needed (since supervisord does not) +environ = os.environ +user_info = pwd.getpwduid(os.getuid()) +environ.setdefault("HOME", user_info["pw_dir"]) +environ.setdefault("USER", user_info["pw_name"]) + def findfiles(pattern): """ Returns a list of files matched by `pattern'. The pattern can include environment variables using the