Commit 9714f5c7 by Michael DeHaan

Merge pull request #517 from goozbach/devel

Updated the file module to handle the case where the UID for the file doesn't exist on the system.
parents 3d7a51f2 fc4ae3e2
......@@ -184,8 +184,14 @@ def user_and_group(filename):
st = os.stat(filename)
uid = st.st_uid
gid = st.st_gid
user = pwd.getpwuid(uid)[0]
group = grp.getgrgid(gid)[0]
try:
user = pwd.getpwuid(uid)[0]
except KeyError:
user = str(uid)
try:
group = grp.getgrgid(gid)[0]
except KeyError:
group = str(gid)
return (user, group)
def set_context_if_different(path, context, changed):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment