aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-06-24 12:56:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-06-24 12:56:03 -0300
commite30a586d269c3f1b90d04b5c73d0a3407bf22291 (patch)
tree707bdea1b8f142ff03c55d88d9c92a2ad59f5406
parent22a5da3bb6931d28ad47acb52ff28e0246e3364a (diff)
downloadhydra-e30a586d269c3f1b90d04b5c73d0a3407bf22291.tar.gz
hydra-e30a586d269c3f1b90d04b5c73d0a3407bf22291.tar.bz2
Deploy: error handling
-rw-r--r--doc/todo.rst1
-rw-r--r--lib/hydra/deploy12
-rwxr-xr-xshare/hydra/deploy8
3 files changed, 19 insertions, 2 deletions
diff --git a/doc/todo.rst b/doc/todo.rst
index 9c579a9..538592b 100644
--- a/doc/todo.rst
+++ b/doc/todo.rst
@@ -5,5 +5,4 @@ TODO
- metrics and alarms subsystem.
- deploy:
- lockfile.
- - error handling.
- log applied version and date (in the node and in the repo).
diff --git a/lib/hydra/deploy b/lib/hydra/deploy
index 333f183..84e31a2 100644
--- a/lib/hydra/deploy
+++ b/lib/hydra/deploy
@@ -204,6 +204,12 @@ function hydra_deploy_copy {
$SUDO cp $orig $dest
elif [ "$location" == "remote" ]; then
$DEPLOY_RSYNC "$RSYNC_PATH" $orig $dest
+
+ # Check result
+ if [ "$?" != "0" ]; then
+ echo "Error copying data to $FQDN."
+ exit 1
+ fi
fi
}
@@ -215,5 +221,11 @@ function hydra_deploy_facts_collect {
$SUDO facter --yaml > $HYDRA_FOLDER/puppet/config/facts/$FQDN.yaml
elif [ "$1" == "remote" ]; then
$HYDRA_CONNECT $FQDN sudo facter --yaml > $HYDRA_FOLDER/puppet/config/facts/$FQDN.yaml
+
+ # Check result
+ if [ "$?" != "0" ]; then
+ echo "Error retrieving facts from $FQDN."
+ exit 1
+ fi
fi
}
diff --git a/share/hydra/deploy b/share/hydra/deploy
index f491e70..e55e545 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -102,7 +102,7 @@ for node in $NODES; do
hydra_deploy_setup remote $node
# Check if puppet is installed
- $HYDRA_CONNECT $node <<EOF
+ $HYDRA_CONNECT $FQDN <<EOF
##### BEGIN REMOTE SCRIPT #####
if ! which puppet &> /dev/null; then
echo "Installing dependencies..."
@@ -112,6 +112,12 @@ for node in $NODES; do
##### END REMOTE SCRIPT #######
EOF
+ # Check connection
+ if [ "$?" != "0" ]; then
+ echo "Error connecting or setting up $FQDN."
+ exit 1
+ fi
+
# Create folders
hydra_deploy_mkdirs