Browse Source

chg: unindent code for cosmetic reasons !minor

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

56
bin/compose

@ -1804,39 +1804,39 @@ _get_master_charm_for_service_cached () {
die "Charm $DARKYELLOW$charm$NORMAL is a subordinate but does not have any 'requires' " \
"section."
fi
master_charm=
found=
while read-0 relation_name relation; do
if [ "$(echo "$relation" | shyaml get-value "scope" 2>/dev/null)" == "container" ]; then
# debug "$DARKYELLOW$service$NORMAL's relation" \
# "$DARKBLUE${relation_name}$NORMAL is a container."
interface="$(echo "$relation" | shyaml get-value "interface" 2>/dev/null)"
if [ -z "$interface" ]; then
err "No ${WHITE}$interface${NORMAL} set for relation $relation_name."
return 1
fi
## Action provided by relation ?
target_service=
while read-0 relation_name candidate_target_service _relation_config _tech_dep; do
[ "$interface" == "$relation_name" ] && {
target_service="$candidate_target_service"
break
}
done < <(get_compose_relations "$service")
if [ -z "$target_service" ]; then
err "Couldn't find ${WHITE}relations.$interface${NORMAL} in" \
"${DARKYELLOW}$service$NORMAL compose definition."
return 1
fi
master_charm=$(get_service_charm "$target_service") || return 1
[ "$(echo "$relation" | shyaml get-value "scope" 2>/dev/null)" == "container" ] && {
found=1
break
fi
}
done < <(echo "$requires" | shyaml key-values-0 2>/dev/null)
if [ -z "$master_charm" ]; then
die "Charm $DARKYELLOW$charm$NORMAL is a subordinate but does not have any relation with" \
if [ -z "$found" ]; then
die "Charm $DARKYELLOW$charm$NORMAL is a subordinate but does not have any required relation declaration with" \
" ${WHITE}scope${NORMAL} set to 'container'."
fi
interface="$(echo "$relation" | shyaml get-value "interface" 2>/dev/null)"
if [ -z "$interface" ]; then
err "No ${WHITE}interface${NORMAL} set for relation $DARKBLUE$relation_name$NORMAL."
return 1
fi
## Action provided by relation ?
found=
while read-0 relation_name target_service _relation_config _tech_dep; do
[ "$interface" == "$relation_name" ] && {
found=1
break
}
done < <(get_compose_relations "$service")
if [ -z "$found" ]; then
err "Couldn't find ${WHITE}relations.$interface${NORMAL} in" \
"${DARKYELLOW}$service$NORMAL compose definition."
return 1
fi
master_charm=$(get_service_charm "$target_service") || return 1
echo "$master_charm" | tee "$cache_file"
}
export -f _get_master_charm_for_service_cached

Loading…
Cancel
Save