Commit e5632b1f authored by Marco Mariani's avatar Marco Mariani Committed by Vincent Pelletier

userinfo: Provide POSIX information about user currently running buildout.

Vincent Pelletier:
- s/_/-/ in exposed names
- Drop slapos.recipe.librecipe.GenericBaseRecipe inheritance
parent 78d86b08
......@@ -197,6 +197,7 @@ setup(name=name,
'trac = slapos.recipe.trac:Recipe',
'urlparse = slapos.recipe._urlparse:Recipe',
'uuid = slapos.recipe._uuid:Recipe',
'userinfo = slapos.recipe.userinfo:Recipe',
'vifib = slapos.recipe.vifib:Recipe',
'waitfor = slapos.recipe.waitfor:Recipe',
'webchecker = slapos.recipe.web_checker:Recipe',
......
import grp
import os
import pwd
class Recipe(object):
"""
Provide POSIX information about the user that is currently running buildout.
"""
def __init__(self, buildout, name, options):
pinfo = pwd.getpwuid(os.getuid())
options['pw-name'] = pinfo.pw_name
options['pw-uid'] = pinfo.pw_uid
options['pw-gid'] = pinfo.pw_gid
options['pw-dir'] = pinfo.pw_dir
options['pw-shell'] = pinfo.pw_shell
ginfo = grp.getgrgid(os.getgid())
options['gr-name'] = ginfo.gr_name
options['gr-gid'] = ginfo.gr_gid
install = update = lambda self: []
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment