|
@ -1172,11 +1172,26 @@ get_charm_tech_dep_orientation_for_relation() { |
|
|
relation_def=$(get_charm_relation_def "$charm" "$relation_name" 2>/dev/null) |
|
|
relation_def=$(get_charm_relation_def "$charm" "$relation_name" 2>/dev/null) |
|
|
value=$(echo "$relation_def" | shyaml get-value 'tech-dep' 2>/dev/null) |
|
|
value=$(echo "$relation_def" | shyaml get-value 'tech-dep' 2>/dev/null) |
|
|
value=${value:-True} |
|
|
value=${value:-True} |
|
|
echo "$value" | tee "$cache_file" |
|
|
|
|
|
|
|
|
printf "%s" "$value" | tee "$cache_file" |
|
|
} |
|
|
} |
|
|
export -f get_charm_tech_dep_orientation_for_relation |
|
|
export -f get_charm_tech_dep_orientation_for_relation |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_service_relation_tech_dep() { |
|
|
|
|
|
local service="$1" relation_name="$2" cache_file="$state_tmpdir/$FUNCNAME.cache.$1.$2" \ |
|
|
|
|
|
charm tech_dep |
|
|
|
|
|
if [ -e "$cache_file" ]; then |
|
|
|
|
|
# debug "$FUNCNAME: cache hit ($*)" |
|
|
|
|
|
cat "$cache_file" |
|
|
|
|
|
return 0 |
|
|
|
|
|
fi |
|
|
|
|
|
charm=$(get_service_charm "$service") || return 1 |
|
|
|
|
|
tech_dep="$(get_charm_tech_dep_orientation_for_relation "$charm" "$relation_name")" || return 1 |
|
|
|
|
|
printf "%s" "$tech_dep" | tee "$cache_file" |
|
|
|
|
|
} |
|
|
|
|
|
export -f get_service_relation_tech_dep |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Use compose file to get deps, and relation definition in metadata.yml |
|
|
## Use compose file to get deps, and relation definition in metadata.yml |
|
|
## for tech-dep attribute. |
|
|
## for tech-dep attribute. |
|
@ -1624,22 +1639,19 @@ _get_compose_relations_cached () { |
|
|
( |
|
|
( |
|
|
case "$(echo "$relation_def" | shyaml get-type 2>/dev/null)" in |
|
|
case "$(echo "$relation_def" | shyaml get-type 2>/dev/null)" in |
|
|
"str") |
|
|
"str") |
|
|
target_service="$(echo "$relation_def" | shyaml get-value 2>/dev/null)" |
|
|
|
|
|
target_charm=$(get_service_charm "$target_service") || return 1 |
|
|
|
|
|
tech_dep="$(get_charm_tech_dep_orientation_for_relation "$target_charm" "$relation_name")" |
|
|
|
|
|
|
|
|
target_service="$(echo "$relation_def" | shyaml get-value 2>/dev/null)" || return 1 |
|
|
|
|
|
tech_dep="$(get_service_relation_tech_dep "$target_service" "$relation_name")" || return 1 |
|
|
echo -en "$relation_name\0$target_service\0\0$tech_dep\0" |
|
|
echo -en "$relation_name\0$target_service\0\0$tech_dep\0" |
|
|
;; |
|
|
;; |
|
|
"sequence") |
|
|
"sequence") |
|
|
while read-0 target_service; do |
|
|
while read-0 target_service; do |
|
|
target_charm=$(get_service_charm "$target_service") || return 1 |
|
|
|
|
|
tech_dep="$(get_charm_tech_dep_orientation_for_relation "$target_charm" "$relation_name")" |
|
|
|
|
|
|
|
|
tech_dep="$(get_service_relation_tech_dep "$target_service" "$relation_name")" || return 1 |
|
|
echo -en "$relation_name\0$target_service\0\0$tech_dep\0" |
|
|
echo -en "$relation_name\0$target_service\0\0$tech_dep\0" |
|
|
done < <(echo "$relation_def" | shyaml get-values-0 2>/dev/null) |
|
|
done < <(echo "$relation_def" | shyaml get-values-0 2>/dev/null) |
|
|
;; |
|
|
;; |
|
|
"struct") |
|
|
"struct") |
|
|
while read-0 target_service relation_config; do |
|
|
while read-0 target_service relation_config; do |
|
|
target_charm=$(get_service_charm "$target_service") || return 1 |
|
|
|
|
|
tech_dep="$(get_charm_tech_dep_orientation_for_relation "$target_charm" "$relation_name")" |
|
|
|
|
|
|
|
|
tech_dep="$(get_service_relation_tech_dep "$target_service" "$relation_name")" || return 1 |
|
|
echo -en "$relation_name\0$target_service\0$relation_config\0$tech_dep\0" |
|
|
echo -en "$relation_name\0$target_service\0$relation_config\0$tech_dep\0" |
|
|
done < <(echo "$relation_def" | shyaml key-values-0 2>/dev/null) |
|
|
done < <(echo "$relation_def" | shyaml key-values-0 2>/dev/null) |
|
|
;; |
|
|
;; |
|
|