Browse Source

new: check compose file yaml before usage.

raw-remaining-args
Valentin Lab 9 years ago
parent
commit
dd92acac87
  1. 12
      bin/compose

12
bin/compose

@ -1799,6 +1799,18 @@ export DOCKER_DATASTORE=${DOCKER_DATASTORE:-/srv/docker-datastore}
export COMPOSE_YML_FILE=$(get_compose_yml_location) || exit 1
debug "Found 'compose.yml' file in '$COMPOSE_YML_FILE'."
output=$(shyaml get-value < "$COMPOSE_YML_FILE" 2>&1)
if [ "$?" != 0 ]; then
err "Invalid YAML in '$COMPOSE_YML_FILE':"
while IFS='' read -r line1 && IFS='' read -r line2; do
echo "$line1 $GRAY($line2)$NORMAL"
done < <(echo "$output" | grep ^yaml.scanner -A 100 |
sed -r 's/^ in "<stdin>", //g' | sed -r 's/^yaml.scanner.[a-zA-Z]+: //g') |
prefix " $GRAY|$NORMAL "
exit 1
fi
if ! [ -d "$CHARM_STORE" ]; then
err "Charm store path $YELLOW$CHARM_STORE$NORMAL does not exists. "
err "Please check your $YELLOW\$CHARM_STORE$NORMAL variable value."

Loading…
Cancel
Save