diff --git a/bin/compose b/bin/compose index c1d11b2..59fb118 100755 --- a/bin/compose +++ b/bin/compose @@ -2212,7 +2212,7 @@ export -f get_default_target_services get_master_services() { - local loaded master_service + local loaded master_service service declare -A loaded for service in "$@"; do 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 " --dry-compose-run If docker-compose will be run, only print out what" 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 | filter_docker_compose_help_message @@ -2606,6 +2608,7 @@ no_init= action= stage="main" ## switches from 'main', to 'action', 'remainder' is_docker_compose_action= +rebuild_relations_to_service=() DC_MATCH_MULTI=$(get_docker_compose_multi_opts_list) && DC_MATCH_SINGLE=$(get_docker_compose_single_opts_list) || return 1 while read-0 arg; do @@ -2649,6 +2652,11 @@ while read-0 arg; do --no-init) export no_init=true ;; + --rebuild-relations-to-service|-R) + read-0 value + rebuild_relations_to_service+=("$value") + shift + ;; --debug) export DEBUG=true export VERBOSE=true @@ -2859,6 +2867,16 @@ if [ "$full_init" ]; then ## Get relations 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_args[@]}" || exit 1 fi