Browse Source

fix: actions would fail on 'charm.run_relation_action' missing.

This is due to the fact that ``stdbuf`` will try to find a direct
process to launch. We must launch bash to make sense of exported
functions.
raw-remaining-args
Valentin Lab 9 years ago
parent
commit
f2e9041fb7
  1. 8
      bin/compose

8
bin/compose

@ -1557,7 +1557,7 @@ _run_service_action_direct() {
export SERVICE_DATASTORE="$DATASTORE/$service"
export SERVICE_CONFIGSTORE="$CONFIGSTORE/$service"
exname="$exname $ACTION_NAME $SERVICE_NAME" \
stdbuf -oL -eL charm.run_direct_action "$charm" "$action" "$@"
stdbuf -oL -eL bash -c 'charm.run_direct_action "$@"' -- "$charm" "$action" "$@"
echo "$?" > "$action_errlvl_file"
) | logstdout "$DARKYELLOW$charm$NORMAL/${DARKCYAN}$action${NORMAL} ${GREEN}@${NORMAL}"
} 3>&1 1>&2 2>&3 | logstderr "$DARKYELLOW$charm$NORMAL/${DARKCYAN}$action${NORMAL} ${RED}@$NORMAL" 3>&1 1>&2 2>&3
@ -1599,7 +1599,7 @@ _run_service_action_relation() {
export SERVICE_DATASTORE="$DATASTORE/$service"
export SERVICE_CONFIGSTORE="$CONFIGSTORE/$service"
exname="$exname $ACTION_NAME $SERVICE_NAME" \
stdbuf -oL -eL charm.run_relation_action "$charm" "$relation_name" "$action" "$@"
stdbuf -oL -eL bash -c 'charm.run_relation_action "$@"' -- "$target_charm" "$relation_name" "$action" "$@"
echo "$?" > "$action_errlvl_file"
) | logstdout "$DARKYELLOW$charm$NORMAL/${DARKCYAN}$action${NORMAL} ${GREEN}@${NORMAL}"
} 3>&1 1>&2 2>&3 | logstderr "$DARKYELLOW$charm$NORMAL/${DARKCYAN}$action${NORMAL} ${RED}@$NORMAL" 3>&1 1>&2 2>&3
@ -1672,14 +1672,14 @@ has_service_action () {
## Action directly provided ?
if charm.has_direct_action "$charm" "$action"; then
if charm.has_direct_action "$charm" "$action" >/dev/null; then
echo -en "direct\0$charm" | tee "$cache_file"
return 0
fi
## Action provided by relation ?
while read-0 relation_name target_service relation_config tech_dep; do
target_charm=$(get_service_charm "$target_service") || return 1
if charm.has_relation_action "$target_charm" "$relation_name" "$action"; then
if charm.has_relation_action "$target_charm" "$relation_name" "$action" >/dev/null; then
echo -en "relation\0$charm\0$target_charm\0$relation_name\0$relation_config" | tee "$cache_file"
return 0
fi

Loading…
Cancel
Save