mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Use ids if user or group is not present.
This commit is contained in:
parent
4a8dbc7f13
commit
ee4c9d59ab
@ -156,7 +156,8 @@ def gid_to_group(gid):
|
|||||||
try:
|
try:
|
||||||
return grp.getgrgid(gid).gr_name
|
return grp.getgrgid(gid).gr_name
|
||||||
except (KeyError, NameError):
|
except (KeyError, NameError):
|
||||||
return ''
|
# If group is not present, fall back to the gid.
|
||||||
|
return gid
|
||||||
|
|
||||||
|
|
||||||
def group_to_gid(group):
|
def group_to_gid(group):
|
||||||
@ -243,7 +244,8 @@ def uid_to_user(uid):
|
|||||||
try:
|
try:
|
||||||
return pwd.getpwuid(uid).pw_name
|
return pwd.getpwuid(uid).pw_name
|
||||||
except (KeyError, NameError):
|
except (KeyError, NameError):
|
||||||
return ''
|
# If user is not present, fall back to the uid.
|
||||||
|
return uid
|
||||||
|
|
||||||
|
|
||||||
def user_to_uid(user):
|
def user_to_uid(user):
|
||||||
|
Loading…
Reference in New Issue
Block a user