Browse Source

new: added ``--rebuild-relations-to-service, -R SERVICE`` to force the rebuild of relations with target service.

raw-remaining-args
Valentin Lab 6 years ago
parent
commit
be5674da9e
  1. 20
      bin/compose

20
bin/compose

@ -2212,7 +2212,7 @@ export -f get_default_target_services
get_master_services() { get_master_services() {
local loaded master_service
local loaded master_service service
declare -A loaded declare -A loaded
for service in "$@"; do for service in "$@"; do
master_service=$(get_top_master_service_for_service "$service") || return 1 master_service=$(get_top_master_service_for_service "$service") || return 1
@ -2390,6 +2390,8 @@ display_help() {
echo " -d, --debug Print full debugging information (sets also verbose)" echo " -d, --debug Print full debugging information (sets also verbose)"
echo " --dry-compose-run If docker-compose will be run, only print out what" echo " --dry-compose-run If docker-compose will be run, only print out what"
echo " command line will be used." echo " command line will be used."
echo " --rebuild-relations-to-service, -R SERVICE"
echo " Will rebuild all relations to given service"
get_docker_compose_opts_help | remove_options_in_option_help_msg --version --help --verbose | get_docker_compose_opts_help | remove_options_in_option_help_msg --version --help --verbose |
filter_docker_compose_help_message filter_docker_compose_help_message
@ -2606,6 +2608,7 @@ no_init=
action= action=
stage="main" ## switches from 'main', to 'action', 'remainder' stage="main" ## switches from 'main', to 'action', 'remainder'
is_docker_compose_action= is_docker_compose_action=
rebuild_relations_to_service=()
DC_MATCH_MULTI=$(get_docker_compose_multi_opts_list) && DC_MATCH_MULTI=$(get_docker_compose_multi_opts_list) &&
DC_MATCH_SINGLE=$(get_docker_compose_single_opts_list) || return 1 DC_MATCH_SINGLE=$(get_docker_compose_single_opts_list) || return 1
while read-0 arg; do while read-0 arg; do
@ -2649,6 +2652,11 @@ while read-0 arg; do
--no-init) --no-init)
export no_init=true export no_init=true
;; ;;
--rebuild-relations-to-service|-R)
read-0 value
rebuild_relations_to_service+=("$value")
shift
;;
--debug) --debug)
export DEBUG=true export DEBUG=true
export VERBOSE=true export VERBOSE=true
@ -2858,6 +2866,16 @@ if [ "$full_init" ]; then
## Get relations ## Get relations
if [ -z "$no_relations" ]; then if [ -z "$no_relations" ]; then
if [ "${#rebuild_relations_to_service[@]}" != 0 ]; then
rebuild_relations_to_service=(
$(get_master_services "${rebuild_relations_to_service[@]}"))
project=$(get_default_project_name) || return 1
for service in "${rebuild_relations_to_service[@]}"; do
for dir in "$VARDIR/relations/$project/"*"-${service}/"*; do
[ -d "$dir" ] && rm -rf "$dir"
done
done
fi
run_service_relations "${services[@]}" || exit 1 run_service_relations "${services[@]}" || exit 1
fi fi

Loading…
Cancel
Save