diff --git a/bin/compose-core b/bin/compose-core index 91a247e..fcf7786 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -2636,6 +2636,7 @@ get_all_relations () { ## situation is stable if [ "${#summon[@]}" != 0 ]; then + declare -A summon_requeued=() while [ "${#summon[@]}" != 0 ]; do service="${summon[0]}" relation_name="${summon[1]}" @@ -2650,9 +2651,18 @@ get_all_relations () { fi if [ "${#providers[@]}" -gt 1 ]; then - warn "Auto-summon ${DARKYELLOW}$service${NORMAL}" \ - "--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\ - "(> 1 provider). Choosing first." + if [ -z "${summon_requeued[$service/$relation_name]}" ]; then + debug "Auto-summon ${DARKYELLOW}$service${NORMAL}" \ + "--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\ + "(> 1 provider). Requeing." + summon+=("$service" "$relation_name" "$relation_def") ## re-queue it + summon_requeued["$service/$relation_name"]=1 + continue + else + warn "Auto-summon ${DARKYELLOW}$service${NORMAL}" \ + "--${DARKBLUE}$relation_name${NORMAL}--> ($DARKYELLOW""${providers[@]}""$NORMAL)"\ + "(> 1 provider). Choosing first." + fi fi ts="${providers[0]}" @@ -2669,6 +2679,7 @@ get_all_relations () { array_read-0 services_uses < <(_get_services_uses "$ts") services[$ts]=1 changed=1 + continue 2 done continue fi