]> gitweb.fluxo.info Git - hydra.git/commitdiff
Deploy: error handling
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 24 Jun 2016 15:56:03 +0000 (12:56 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 24 Jun 2016 15:56:03 +0000 (12:56 -0300)
doc/todo.rst
lib/hydra/deploy
share/hydra/deploy

index 9c579a9285e064649b4d17226d0d662264322477..538592bbdd1205e85e677b16d2cd567b59a494f3 100644 (file)
@@ -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).
index 333f18380d50db78682f0e3f98369720468a351d..84e31a2b0cfe204f57bc6bae97f8af91c5834b96 100644 (file)
@@ -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
 }
index f491e7097d172c818aa24c0d63517461065d1758..e55e5459dbf639c2f5ea13be208aa16f13fe3f49 100755 (executable)
@@ -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