Skip to content

Commit

Permalink
stop copying unneccesary files into user home directory (nebari-dev#2578
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Adam-D-Lewis authored Jul 24, 2024
1 parent 175a732 commit 2000996
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ def base_profile_home_mounts(username):
}

MKDIR_OWN_DIRECTORY = (
"mkdir -p /mnt/{path} && chmod 777 /mnt/{path} && cp -r /etc/skel/. /mnt/{path}"
"mkdir -p /mnt/{path} && chmod 777 /mnt/{path} && "
# Copy skel files/folders not starting with '..' to user home directory.
# Filtering out ..* removes some unneeded folders (k8s configmap mount implementation details).
"find /etc/skel/. -maxdepth 1 -not -name '.' -not -name '..*' -exec "
"cp -rL {escaped_brackets} /mnt/{path} \;"
)
command = MKDIR_OWN_DIRECTORY.format(
path=pvc_home_mount_path.format(username=username)
# have to escape the brackets since this string will be formatted later by KubeSpawner
escaped_brackets="{{}}",
path=pvc_home_mount_path.format(username=username),
)
init_containers = [
{
Expand Down
3 changes: 3 additions & 0 deletions tests/tests_deployment/test_jupyterhub_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def test_contains_jupyterhub_ssh(paramiko_object):
("cat ~/.bashrc", "Managed by Nebari"),
("cat ~/.profile", "Managed by Nebari"),
("cat ~/.bash_logout", "Managed by Nebari"),
# ensure we don't copy over extra files from /etc/skel in init container
("ls -la ~/..202*", "No such file or directory"),
("ls -la ~/..data", "No such file or directory"),
]

for command, output in commands_contain:
Expand Down

0 comments on commit 2000996

Please sign in to comment.