add plugin infrastructure to user script

This commit is contained in:
johannes.kaufmann
2019-10-24 15:52:37 +02:00
parent 3cea0cb323
commit 07e487a199

View File

@@ -3,11 +3,20 @@ User management for tljh.
Supports minimal user & group management Supports minimal user & group management
""" """
import pwd
import grp import grp
import pwd
import subprocess import subprocess
from os.path import expanduser from os.path import expanduser
import pluggy
from tljh import hooks
# Set up plugin infrastructure
pm = pluggy.PluginManager('tljh')
pm.add_hookspecs(hooks)
pm.load_setuptools_entrypoints('tljh')
def ensure_user(username): def ensure_user(username):
""" """
@@ -28,9 +37,11 @@ def ensure_user(username):
username username
]) ])
pm.hook.tljh_new_user_create(username=username)
subprocess.check_call([ subprocess.check_call([
'chmod', 'chmod',
'o-rwx', 'o-rwx',
expanduser('~{username}'.format(username=username)) expanduser('~{username}'.format(username=username))
]) ])