Browse Source

new: ``compose config`` on validation success outputs the final docker-compose file on standard output instead of standard error.

test
Valentin Lab 6 years ago
parent
commit
a024649a5f
  1. 7
      bin/compose
  2. 17
      test/base

7
bin/compose

@ -2960,7 +2960,12 @@ case "$action" in
config) config)
## removing the services ## removing the services
services=($(get_master_services "${action_posargs[@]}")) || exit 1 services=($(get_master_services "${action_posargs[@]}")) || exit 1
launch_docker_compose "${compose_opts[@]}" "$action" "${action_opts[@]}" "${remainder_args[@]}"
## forcing docker-compose config to output the config file to stdout and not stderr
out=$(launch_docker_compose "${compose_opts[@]}" "$action" "${action_opts[@]}" "${remainder_args[@]}" 2>&1) || {
echo "$out"
exit 1
}
echo "$out"
warn "Runtime configuration modification (from relations) are not included here." warn "Runtime configuration modification (from relations) are not included here."
;; ;;
down) down)

17
test/base

@ -1243,7 +1243,22 @@ EOF2
cd "$test_tmpdir" cd "$test_tmpdir"
export DISABLE_SYSTEM_CONFIG_FILE=true export DISABLE_SYSTEM_CONFIG_FILE=true
"$tprog" config
out=\$("$tprog" config) || exit 1
expected="networks:
static:
driver: bridge
ipam:
config:
- subnet: 172.25.1.0/24
driver: default
services: {}
version: '2.0'"
[ "\$out" == "\$expected" ] || {
echo -e "DIFF:\n\$(diff <(echo "\$out") <(echo "\$expected"))"
exit 1
}
## -- simple service provided ## -- simple service provided

Loading…
Cancel
Save