diff --git a/bin/compose-core b/bin/compose-core index a32bd67..ecc3233 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -2148,7 +2148,7 @@ service:relation-file() { fi relation="${service_path##*${TRAVERSE_SEPARATOR}}" service=$(service:traverse "${service_path%${TRAVERSE_SEPARATOR}*}") || return 1 - if ! read-0 ts _ _ < <(get_service_relation "${service}" "${relation}"); then + if ! read-0 ts rc _ < <(get_service_relation "${service}" "${relation}"); then err "Couldn't find relation ${DARKCYAN}${relation}${NORMAL}" \ "from ${DARKYELLOW}$service${NORMAL}." return 1 @@ -2157,7 +2157,12 @@ service:relation-file() { err "Failed to find relation file" return 1 } - echo "$relation_dir/data" + relation_file="$relation_dir/data" + if ! [ -e "$relation_file" ]; then + e "$rc" > "$relation_file" + chmod go-rwx "$relation_file" ## protecting this file + fi + echo "$relation_file" } export -f service:relation-file