MCPcopy Create free account
hub / github.com/celery/celery / setgroups

Function setgroups

celery/platforms.py:549–563  ·  view source on GitHub ↗

Set active groups from a list of group ids.

(groups)

Source from the content-addressed store, hash-verified

547
548
549def setgroups(groups):
550 """Set active groups from a list of group ids."""
551 max_groups = None
552 try:
553 max_groups = os.sysconf('SC_NGROUPS_MAX')
554 except Exception: # pylint: disable=broad-except
555 pass
556 try:
557 return _setgroups_hack(groups[:max_groups])
558 except OSError as exc:
559 if exc.errno != errno.EPERM:
560 raise
561 if any(group not in groups for group in os.getgroups()):
562 # we shouldn't be allowed to change to this group.
563 raise
564
565
566def initgroups(uid, gid):

Callers 5

test_setgroupsMethod · 0.90
initgroupsFunction · 0.85

Calls 1

_setgroups_hackFunction · 0.85

Tested by 4

test_setgroupsMethod · 0.72