From a968ccc3a94539bbda765b5473ffdc63fdaf58c6 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 27 Nov 2019 23:39:12 +0100 Subject: [PATCH] chg: remove charm-store inner link support Links were poorly supported and are a pain in the ass due to docker volumes deferencing links in the container side before making the bind mount, preventing overriding links in the container file system. Signed-off-by: Valentin Lab --- bin/compose | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/compose b/bin/compose index 895b289..ad1f211 100755 --- a/bin/compose +++ b/bin/compose @@ -358,15 +358,17 @@ clean_unused_sessions() { } -relink_subdirs() { +check_no_links_subdirs() { local dir for dir in "$@"; do - [ -L "$dir" ] || continue - target=$(realpath "$dir") - [ -d "$target" ] || continue - docker_run_opts+=("-v" "$target:$dir") + [ -d "$dir" ] || continue + if [ -L "$dir" ]; then + err "Unfortunately, this compose launcher do not support yet symlinks in charm-store." + echo " Found symlink in charm-store: $dir" >&2 + return 1 + fi [ -e "$dir/metadata.yml" ] && continue - relink_subdirs "$dir"/* + check_no_links_subdirs "$dir"/* || return 1 done } @@ -540,7 +542,7 @@ mk_docker_run_options() { "-e" "CHARM_STORE=/srv/charm-store" "-e" "HOST_CHARM_STORE=$CHARM_STORE" ) - relink_subdirs "$CHARM_STORE"/* + check_no_links_subdirs "$CHARM_STORE"/* || exit 1 ## DEFAULT_COMPOSE_FILE if [ "${DEFAULT_COMPOSE_FILE+x}" ]; then