mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
don't run the os.getgrouplist function inside the comprehension
This commit is contained in:
parent
eaa004dd64
commit
ac2408477d
1 changed files with 2 additions and 1 deletions
|
@ -293,10 +293,11 @@ def get_group_list(user, include_default=True):
|
|||
# Try os.getgrouplist, available in python >= 3.3
|
||||
log.trace("Trying os.getgrouplist for '%s'", user)
|
||||
try:
|
||||
user_group_list = os.getgrouplist(user, pwd.getpwnam(user).pw_gid)
|
||||
group_names = [
|
||||
_group.gr_name
|
||||
for _group in grp.getgrall()
|
||||
if _group.gr_gid in os.getgrouplist(user, pwd.getpwnam(user).pw_gid)
|
||||
if _group.gr_gid in user_group_list
|
||||
]
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue