From: Silvio Rhatto Date: Fri, 24 Jun 2016 15:56:03 +0000 (-0300) Subject: Deploy: error handling X-Git-Tag: 0.2.4~122 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=e30a586d269c3f1b90d04b5c73d0a3407bf22291;p=hydra.git Deploy: error handling --- 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 < /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