Make configurator disabled by default

This commit is contained in:
GeorgianaElena
2021-04-05 21:42:01 +03:00
parent 32e0f99c3c
commit 3ff80378c9
2 changed files with 8 additions and 3 deletions

View File

@@ -68,7 +68,7 @@ default = {
'max_age': 0 'max_age': 0
}, },
'configurator': { 'configurator': {
'enabled': True 'enabled': False
} }
} }
} }

View File

@@ -1,10 +1,10 @@
from tljh.normalize import generate_system_username from tljh.normalize import generate_system_username
from tljh import user from tljh import user
from tljh import configurer
from systemdspawner import SystemdSpawner from systemdspawner import SystemdSpawner
from traitlets import Dict, Unicode, List from traitlets import Dict, Unicode, List
from jupyterhub_configurator.mixins import ConfiguratorSpawnerMixin
class UserCreatingSpawner(ConfiguratorSpawnerMixin, SystemdSpawner): class CustomSpawner(SystemdSpawner):
""" """
SystemdSpawner with user creation on spawn. SystemdSpawner with user creation on spawn.
@@ -33,3 +33,8 @@ class UserCreatingSpawner(ConfiguratorSpawnerMixin, SystemdSpawner):
user.ensure_user_group(system_username, group) user.ensure_user_group(system_username, group)
return super().start() return super().start()
cfg = configurer.load_config()
if cfg['services']['configurator']['enabled']:
UserCreatingSpawner = type('UserCreatingSpawner', (ConfiguratorSpawnerMixin, CustomSpawner), {})
else:
UserCreatingSpawner = type('UserCreatingSpawner', (CustomSpawner,), {})