Browse Source

new: bail out when failing to read compose file and be more explicit

test
Valentin Lab 6 years ago
parent
commit
a03ae8ba51
  1. 7
      bin/compose

7
bin/compose

@ -2229,7 +2229,7 @@ get_compose_yml_location() {
echo "$COMPOSE_YML_FILE" echo "$COMPOSE_YML_FILE"
return 0 return 0
fi fi
parent=$(while ! [ -e "./compose.yml" ]; do
parent=$(while ! [ -f "./compose.yml" ]; do
[ "$PWD" == "/" ] && exit 0 [ "$PWD" == "/" ] && exit 0
cd .. cd ..
done; echo "$PWD" done; echo "$PWD"
@ -2269,7 +2269,10 @@ get_compose_yml_content() {
fi fi
if [ -e "$COMPOSE_YML_FILE" ]; then if [ -e "$COMPOSE_YML_FILE" ]; then
debug "Found $WHITE$exname$NORMAL YAML file in '$COMPOSE_YML_FILE'." debug "Found $WHITE$exname$NORMAL YAML file in '$COMPOSE_YML_FILE'."
COMPOSE_YML_CONTENT=$(cat "$COMPOSE_YML_FILE")
COMPOSE_YML_CONTENT=$(cat "$COMPOSE_YML_FILE") || {
err "Could not read '$COMPOSE_YML_FILE'."
return 1
}
else else
debug "No compose file found. Using an empty one." debug "No compose file found. Using an empty one."
COMPOSE_YML_CONTENT="" COMPOSE_YML_CONTENT=""

Loading…
Cancel
Save