Revision 2f8b60b3 lib/utils.py

b/lib/utils.py
33 33
import tempfile
34 34
import shutil
35 35
import errno
36
import pwd
36 37

  
37 38
from ganeti import logger
38 39
from ganeti import errors
......
822 823

  
823 824
  """
824 825
  return [i for i in os.listdir(path) if not i.startswith(".")]
826

  
827

  
828
def GetHomeDir(uid, default=None):
829
  """Try to get the homedir of the given user id.
830

  
831
  """
832
  try:
833
    result = pwd.getpwuid(uid)
834
  except KeyError:
835
    return default
836
  return result.pw_dir

Also available in: Unified diff