diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-04-12 23:59:27 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-04-12 23:59:27 -0300 |
commit | 73d17146d0d5fd71d4f4aa54a374a87d4577dd36 (patch) | |
tree | 6ea9ca681ff1efe65547c0d8ac9623ac42c233f4 /lib | |
parent | be3642b12f752622166428a79a3466c533fc79ec (diff) | |
download | hydra-73d17146d0d5fd71d4f4aa54a374a87d4577dd36.tar.gz hydra-73d17146d0d5fd71d4f4aa54a374a87d4577dd36.tar.bz2 |
Using hydra_safe_run on provision
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hydra/misc | 14 |
1 files changed, 14 insertions, 0 deletions
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 $* +} |