From e665f7cd208739df84373f0f65184c6b561e3de2 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 24 Jun 2016 13:26:38 -0300 Subject: Deploy: log support --- doc/todo.rst | 1 - lib/hydra/deploy | 4 ++-- share/hydra/deploy | 9 ++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/todo.rst b/doc/todo.rst index 538592b..2215440 100644 --- a/doc/todo.rst +++ b/doc/todo.rst @@ -5,4 +5,3 @@ TODO - metrics and alarms subsystem. - deploy: - lockfile. - - log applied version and date (in the node and in the repo). diff --git a/lib/hydra/deploy b/lib/hydra/deploy index 96dd67b..cd46fad 100644 --- a/lib/hydra/deploy +++ b/lib/hydra/deploy @@ -15,8 +15,8 @@ function hydra_deploy_setup { # Fix puppet folder permissions chmod 700 $HYDRA_FOLDER/puppet - # Ensure facts folder - mkdir -p $HYDRA_FOLDER/puppet/config/facts + # Ensure facts folder and logs foldes + mkdir -p $HYDRA_FOLDER/puppet/{config/facts,logs} if [ "$1" == "remote" ]; then # Deploy in a remote host diff --git a/share/hydra/deploy b/share/hydra/deploy index 38d8bcb..3cec85f 100755 --- a/share/hydra/deploy +++ b/share/hydra/deploy @@ -73,7 +73,8 @@ for node in $NODES; do # Run puppet, overriding FQDN echo "Applying configuration..." - LC_ALL=C HOSTNAME=$FQDN FACTER_domain=$DOMAIN FACTER_hostname=$FQDN FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY + LC_ALL=C HOSTNAME=$FQDN FACTER_domain=$DOMAIN FACTER_hostname=$FQDN FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY 2>&1 | \ + tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%M%d%H%M`.log elif [ "$node" == "localhost" ] || [ "$node" == "`facter fqdn`" ] || [ "$node" == "`facter hostname`" ]; then echo "Deploying to localhost..." @@ -94,7 +95,8 @@ for node in $NODES; do # Run puppet echo "Applying configuration..." - $DEPLOY_APPLY + $DEPLOY_APPLY 2>&1 | \ + tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%M%d%H%M`.log else echo "Deploying to $node..." @@ -142,6 +144,7 @@ EOF # Run puppet echo "Applying configuration..." - $DEPLOY_APPLY + $DEPLOY_APPLY 2>&1 | \ + tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%M%d%H%M`.log fi done -- cgit v1.2.3