From d4c6da52e1a73ce3cb44b68f90e9538250d9ab80 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 6 Jun 2023 14:09:03 +0200 Subject: [PATCH] maint: let installer ensure /etc/sudoers.d directory exists --- integration-tests/Dockerfile | 2 -- tljh/installer.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/integration-tests/Dockerfile b/integration-tests/Dockerfile index 22cd2d4..c1c73d8 100644 --- a/integration-tests/Dockerfile +++ b/integration-tests/Dockerfile @@ -24,8 +24,6 @@ RUN find /etc/systemd/system \ -not -name '*systemd-user-sessions*' \ -exec rm \{} \; -RUN mkdir -p /etc/sudoers.d - RUN systemctl set-default multi-user.target STOPSIGNAL SIGRTMIN+3 diff --git a/tljh/installer.py b/tljh/installer.py index 668f30c..33cce12 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -126,6 +126,7 @@ def ensure_usergroups(): user.ensure_group("jupyterhub-users") logger.info("Granting passwordless sudo to JupyterHub admins...") + os.makedirs("/etc/sudoers.d/", exist_ok=True) with open("/etc/sudoers.d/jupyterhub-admins", "w") as f: # JupyterHub admins should have full passwordless sudo access f.write("%jupyterhub-admins ALL = (ALL) NOPASSWD: ALL\n")