diff --git a/integration-tests/test_hub.py b/integration-tests/test_hub.py index 48ad4d7..d47893d 100644 --- a/integration-tests/test_hub.py +++ b/integration-tests/test_hub.py @@ -156,7 +156,7 @@ async def test_user_group_adding(): system('groupadd somegroup') assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'set', 'auth.type', 'dummyauthenticator.DummyAuthenticator')).wait() - assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'add-item', 'users.groups.somegroup', username)).wait() + assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'add-item', 'users.extra_user_groups.somegroup', username)).wait() assert 0 == await (await asyncio.create_subprocess_exec(*TLJH_CONFIG_PATH, 'reload')).wait() try: diff --git a/tests/test_configurer.py b/tests/test_configurer.py index 3cc3c20..1857af5 100644 --- a/tests/test_configurer.py +++ b/tests/test_configurer.py @@ -129,22 +129,22 @@ def test_auth_dummy(): assert c.JupyterHub.authenticator_class == 'dummyauthenticator.DummyAuthenticator' assert c.DummyAuthenticator.password == 'test' - +from traitlets import Dict def test_user_groups(): """ Test setting user groups """ c = apply_mock_config({ 'users': { - 'groups': { + 'extra_user_groups': { "g1": ["u1", "u2"], - "g1": ["u3", "u4"] + "g2": ["u3", "u4"] }, } }) assert c.UserCreatingSpawner.user_groups == { "g1": ["u1", "u2"], - "g1": ["u3", "u4"] + "g2": ["u3", "u4"] } diff --git a/tljh/configurer.py b/tljh/configurer.py index b045f2b..eb5664b 100644 --- a/tljh/configurer.py +++ b/tljh/configurer.py @@ -27,7 +27,7 @@ default = { 'allowed': [], 'banned': [], 'admin': [], - 'groups': {} + 'extra_user_groups': {} }, 'limits': { 'memory': None, @@ -175,7 +175,7 @@ def update_usergroups(c, config): Set user groups """ users = config['users'] - c.UserCreatingSpawner.user_groups = users['groups'] + c.UserCreatingSpawner.user_groups = users['extra_user_groups'] def update_limits(c, config): diff --git a/tljh/jupyterhub_config.py b/tljh/jupyterhub_config.py index 11ee138..325d9c6 100644 --- a/tljh/jupyterhub_config.py +++ b/tljh/jupyterhub_config.py @@ -13,7 +13,7 @@ from tljh.normalize import generate_system_username from tljh.yaml import yaml from jupyterhub_traefik_proxy import TraefikTomlProxy -from traitlets import Any +from traitlets import Dict class UserCreatingSpawner(SystemdSpawner): """ @@ -21,7 +21,7 @@ class UserCreatingSpawner(SystemdSpawner): FIXME: Remove this somehow? """ - user_groups = Any(config=True) + user_groups = Dict(config=True) def start(self): """