mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Prevent KeyError on calling grp.getgrnam in case of improper group
This commit is contained in:
parent
d3f204e959
commit
8e89a094f1
1 changed files with 5 additions and 1 deletions
|
@ -352,7 +352,11 @@ def get_group_dict(user=None, include_default=True):
|
|||
group_dict = {}
|
||||
group_names = get_group_list(user, include_default=include_default)
|
||||
for group in group_names:
|
||||
group_dict.update({group: grp.getgrnam(group).gr_gid})
|
||||
try:
|
||||
group_dict.update({group: grp.getgrnam(group).gr_gid})
|
||||
except KeyError:
|
||||
# In case if imporer duplicate group was returned by get_group_list
|
||||
pass
|
||||
return group_dict
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue