From fcdce11cae044df7bc84c6cc6c358ffd770fff29 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sun, 22 Jul 2018 23:56:58 -0700 Subject: [PATCH] ensure state dir exists before putting files in it --- tljh/installer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tljh/installer.py b/tljh/installer.py index 8b272d3..219fcf6 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -112,6 +112,9 @@ def ensure_jupyterhub_service(prefix): """ Ensure JupyterHub Services are set up properly """ + + os.makedirs(STATE_DIR, mode=0o700, exist_ok=True) + with open(os.path.join(HERE, 'systemd-units', 'jupyterhub.service')) as f: hub_unit_template = f.read() @@ -133,8 +136,6 @@ def ensure_jupyterhub_service(prefix): systemd.install_unit('traefik.service', traefik_unit_template.format(**unit_params)) systemd.reload_daemon() - os.makedirs(STATE_DIR, mode=0o700, exist_ok=True) - # Set up proxy / hub secret oken if it is not already setup proxy_secret_path = os.path.join(STATE_DIR, 'configurable-http-proxy.secret') if not os.path.exists(proxy_secret_path):