From 73d17146d0d5fd71d4f4aa54a374a87d4577dd36 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 12 Apr 2012 23:59:27 -0300 Subject: Using hydra_safe_run on provision --- lib/hydra/misc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/hydra/misc b/lib/hydra/misc index 34abf1a..eb0a9aa 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -81,3 +81,17 @@ function hydra_check_group { grep -qe "^$1:" /etc/group } + +# Abort on error +function hydra_exit_on_error { + if [ "$?" != "0" ]; then + echo "Error: $*" + exit 1 + fi +} + +# Run a command or abort +function hydra_safe_run { + $* + hydra_exit_on_error $* +} -- cgit v1.2.3