saltstack/salt — pull request #11222 by dlanderson (2014-03-14 06:16:42+00:00)
Title: Avoid unnecessary getgrall code. Use getgrouplist if available

This code should greatly improve speed for systems that must talk to a remote ldap server that has thousands of users/groups over slow links. This should fix https://github.com/saltstack/salt/issues/9743

- The new functions in salt.utils will first try to use os.getgrouplist() which is available in python >= 3.3
- If that fails, try to use pysss.getgrouplist() which is the equivalent of os.getgrouplist() for python < 3.3. In order to use this, you must have a python sssd library that supports getgrouplist().
- Failing those two options, it will fall back to using to looping over grp.getgrall().

The salt.utils.get_group_list() function will return the user's primary group, which is a different behavior than the old getgrall() loop used historically by salt. This should not cause a problem with most things, but can be turned off by passing include_default=False when called.