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

Function initgroups

celery/platforms.py:566–579  ·  view source on GitHub ↗

Init process group permissions. Compat version of :func:`os.initgroups` that was first added to Python 2.7.

(uid, gid)

Source from the content-addressed store, hash-verified

564
565
566def initgroups(uid, gid):
567 """Init process group permissions.
568
569 Compat version of :func:`os.initgroups` that was first
570 added to Python 2.7.
571 """
572 if not pwd: # pragma: no cover
573 return
574 username = pwd.getpwuid(uid)[0]
575 if hasattr(os, 'initgroups'): # Python 2.7+
576 return os.initgroups(username, gid)
577 groups = [gr.gr_gid for gr in grp.getgrall()
578 if username in gr.gr_mem]
579 setgroups(groups)
580
581
582def setgid(gid):

Callers 3

test_with_initgroupsMethod · 0.90
_setuidFunction · 0.85

Calls 1

setgroupsFunction · 0.85

Tested by 2

test_with_initgroupsMethod · 0.72