From 7d860f732ae4c6514d878fb92f0046c548d05cea Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 29 Aug 2023 19:17:35 +0200 Subject: [PATCH] fix: [compose-core] display errors when running action and constraints are not verified Before it would quit without any notice. A message is also added for a common fix when constraints fails unexpectedly. --- bin/compose-core | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/compose-core b/bin/compose-core index aeffbc3..d557575 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -2611,7 +2611,8 @@ get_all_relations () { providers_def=() array_read-0 providers providers_def < <(_get_charm_providing "$relation_name" "${service_list[@]}") if [ "${#providers[@]}" == 0 ]; then - die "Summoning a ${DARKBLUE}$relation_name${NORMAL} provider failed: none were found in charm store." + err "Summoning a ${DARKBLUE}$relation_name${NORMAL} provider failed: none were found in charm store." + return 1 fi if [ "${#providers[@]}" -gt 1 ]; then @@ -4322,7 +4323,10 @@ if [ -z "$is_docker_compose_action" -a "$action" ]; then esac } < <(has_service_action "$action_service" "$action") services_args=("$action_service") - get_all_relations "${services_args[@]}" >/dev/null 2>&1 || exit 1 + get_all_relations "${services_args[@]}" >/dev/null || { + echo " Hint: if this is unexpected, you can try to delete caches, and re-run the command." >&2 + exit 1 + } ## Divert logging to stdout to stderr log () { cat >&2; }