From ae93b03cb14565ec7adf24965c6900a11d1f2950 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 5 Feb 2019 18:00:33 +0100 Subject: [PATCH] new: hook ``dc-post-run`` is also called after a run --- bin/compose-core | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/compose-core b/bin/compose-core index d00ea9a..ffede24 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -4020,8 +4020,8 @@ fi if [ "$action" == "run" -a "${#services_args}" != 0 ]; then charm=$(get_service_charm "${services_args[0]}") || exit 1 metadata=$(charm.metadata "$charm") || exit 1 - type="$(printf "%s" "$metadata" | shyaml get-value type 2>/dev/null)" || true - if [ "$type" == "run-once" ]; then + SERVICE_TYPE="$(printf "%s" "$metadata" | shyaml get-value type 2>/dev/null)" || true + if [ "$SERVICE_TYPE" == "run-once" ]; then run_service_hook dc-pre-run "${services_args[@]}" || exit 1 fi fi @@ -4090,4 +4090,10 @@ if [ "$post_hook" -a "${#services_args[@]}" != 0 ]; then run_service_hook post_deploy "${services_args[@]}" || exit 1 fi +if [ "$action" == "run" -a "${#services_args}" != 0 ]; then + if [ "$SERVICE_TYPE" == "run-once" ]; then + run_service_hook dc-post-run "${services_args[@]}" || exit 1 + fi +fi + clean_unused_docker_compose || return 1