Skip to content

Commit

Permalink
ignore parent path when making dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Sep 13, 2024
1 parent 412092e commit 847d68d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/jupyterhub_config/custom_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _ensure_user_directory(self, user_dir: Path, username: str):
gid = user_info.pw_gid

self.log.info(f'Creating user directory for {username}')
user_dir.mkdir(parents=True, exist_ok=True) # guard against race conditions
user_dir.mkdir(exist_ok=True) # guard against race conditions

# Change the directory's ownership to the user
os.chown(user_dir, uid, gid)
Expand All @@ -139,9 +139,9 @@ def _ensure_user_jupyter_directory(self, user_dir: Path):
jupyter_runtime_dir = jupyter_dir / 'runtime'
juputer_data_dir = jupyter_dir / 'data'

jupyter_dir.mkdir(parents=True, exist_ok=True)
jupyter_runtime_dir.mkdir(parents=True, exist_ok=True)
juputer_data_dir.mkdir(parents=True, exist_ok=True)
jupyter_dir.mkdir(exist_ok=True)
jupyter_runtime_dir.mkdir(exist_ok=True)
juputer_data_dir.mkdir(exist_ok=True)

self.environment['JUPYTER_CONFIG_DIR'] = str(jupyter_dir)
self.environment['JUPYTER_RUNTIME_DIR'] = str(jupyter_runtime_dir)
Expand All @@ -153,7 +153,7 @@ def _ensure_virtual_environment(self, user_env_dir: Path):
created with the system site-packages included.
"""
if not user_env_dir.exists():
user_env_dir.mkdir(parents=True)
user_env_dir.mkdir(exist_ok=True)
self.log.info(f'Creating virtual environment for {self.user.name}')
try:
# Create a virtual environment with system site-packages access
Expand Down

0 comments on commit 847d68d

Please sign in to comment.