From 255bbdb466b87e9d7411d9c1600f0ed2bcc4ac8c Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 3 Aug 2018 14:03:23 +0200 Subject: [PATCH] fix: [apache] bail out as soon as posisble on failures --- apache/hooks/web_proxy-relation-joined | 7 +++---- apache/lib/common | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apache/hooks/web_proxy-relation-joined b/apache/hooks/web_proxy-relation-joined index 58f1c6f6..1bff937d 100755 --- a/apache/hooks/web_proxy-relation-joined +++ b/apache/hooks/web_proxy-relation-joined @@ -1,15 +1,14 @@ #!/bin/bash - ## Should be executable N time in a row with same result. -. lib/common - set -e +. lib/common + apache_proxy_dir APACHE_CORE_RULES=$(relation-get apache-core-rules 2>/dev/null) || true if [ "$APACHE_CORE_RULES" ]; then - apache_core_rules_add "$APACHE_CORE_RULES" + apache_core_rules_add "$APACHE_CORE_RULES" || exit 1 fi diff --git a/apache/lib/common b/apache/lib/common index 50d993a8..4c237918 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -6,7 +6,7 @@ apache_proxy_dir () { err "You must specify a ${WHITE}domain$NORMAL option in relation." return 1 } - proxy=yes apache_vhost_create + proxy=yes apache_vhost_create || return 1 info "Added $DOMAIN as a proxy to $TARGET." } export -f apache_proxy_dir @@ -40,7 +40,7 @@ apache_vhost_create () { __vhost_cfg_creds_enabled=$(relation-get creds 2>/dev/null) || true if [ "$__vhost_cfg_creds_enabled" ]; then - apache_passwd_file + apache_passwd_file || return 1 fi if is_protocol_enabled https; then