Browse Source

chg: dev: refactor out ``setup_host_resource``.

raw-remaining-args
Valentin Lab 9 years ago
parent
commit
f1d165765d
  1. 31
      bin/compose

31
bin/compose

@ -1162,18 +1162,8 @@ host_resource_get_git-sub() {
export -f host_resource_get_git-sub
setup_host_resources () {
local services="$1" action="$2" loaded location cfg
declare -A loaded
for service in $services; do
for subservice in $(get_ordered_service_dependencies "$service"); do
if [ "${loaded[$subservice]}" ]; then
## Prevent double inclusion of same service if this
## service is deps of two or more of your
## requirements.
continue
fi
setup_host_resource () {
local service="$1" service_def location get cfg
service_def=$(get_compose_service_def "$subservice") || return 1
while read-0 location cfg; do
@ -1195,12 +1185,29 @@ setup_host_resources () {
fi
host_resource_get "$location" "$get" || return 1
done < <(echo "$service_def" | shyaml key-values-0 host-resources 2>/dev/null)
}
export -f setup_host_resource
setup_host_resources () {
local services="$1" loaded
declare -A loaded
for service in $services; do
for subservice in $(get_ordered_service_dependencies "$service"); do
if [ "${loaded[$subservice]}" ]; then
## Prevent double inclusion of same service if this
## service is deps of two or more of your
## requirements.
continue
fi
setup_host_resource "$service"
loaded[$subservice]=1
done
done
return 0
}
export -f setup_host_resources
relation-get () {

Loading…
Cancel
Save