summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-04-12 23:59:27 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-04-12 23:59:27 -0300
commit73d17146d0d5fd71d4f4aa54a374a87d4577dd36 (patch)
tree6ea9ca681ff1efe65547c0d8ac9623ac42c233f4 /lib
parentbe3642b12f752622166428a79a3466c533fc79ec (diff)
downloadhydra-73d17146d0d5fd71d4f4aa54a374a87d4577dd36.tar.gz
hydra-73d17146d0d5fd71d4f4aa54a374a87d4577dd36.tar.bz2
Using hydra_safe_run on provision
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/misc14
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 $*
+}