Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remote.functions: group/user id may be unidentifiable
Signed-off-by: Alfredo Deza <adeza@redhat.com>
  • Loading branch information
Alfredo Deza committed Feb 26, 2019
1 parent 6e4b57d commit 84b6c76
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ceph_medic/remote/functions.py
Expand Up @@ -56,8 +56,14 @@ def stat_path(path, skip_dirs=None, skip_files=None, get_contents=False):
metadata[attr] = value

# translate the owner and group:
metadata[u'owner'] = decoded(pwd.getpwuid(stat_info.st_uid)[0])
metadata[u'group'] = decoded(grp.getgrgid(stat_info.st_gid)[0])
try:
metadata[u'owner'] = decoded(pwd.getpwuid(stat_info.st_uid)[0])
except KeyError:
metadata[u'owner'] = stat_info.st_uid
try:
metadata[u'group'] = decoded(grp.getgrgid(stat_info.st_gid)[0])
except KeyError:
metadata[u'group'] = stat_info.st_gid

return metadata

Expand Down

0 comments on commit 84b6c76

Please sign in to comment.