From cb1772f1876bf025cdbc0ffd0236d5985f52cdc6 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 4 May 2022 10:01:30 +0200 Subject: [PATCH] fix: [compose-core] make ``get_relation_data_dir()`` output correct directory even when run from a relation Signed-off-by: Valentin Lab --- bin/compose-core | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/compose-core b/bin/compose-core index ecc3233..e3e0f8f 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -2812,8 +2812,11 @@ get_relation_data_dir() { cat "$cache_file" return 0 fi - - project=$(get_default_project_name) || return 1 + local project relation_dir + project=${PROJECT_NAME} + if [ -z "$project" ]; then + project=$(get_default_project_name) || return 1 + fi relation_dir="$VARDIR/relations/$project/${service}-${target_service}/$relation_name" if ! [ -d "$relation_dir" ]; then mkdir -p "$relation_dir" || return 1