aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-11-15 11:34:27 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-11-15 11:34:27 -0200
commit814056989dc2edcb5f8e964cf787dbb8ad0988db (patch)
treed51148db92b1b9a7822e1ff5c62cc050e6918d2d
parent09ac0e2a87d71451b8ffac41cd072f3cfb19c2e3 (diff)
downloadpuppet-drupal-814056989dc2edcb5f8e964cf787dbb8ad0988db.tar.gz
puppet-drupal-814056989dc2edcb5f8e964cf787dbb8ad0988db.tar.bz2
Introducing drupal_update function
-rw-r--r--templates/drupal.sh.erb25
1 files changed, 23 insertions, 2 deletions
diff --git a/templates/drupal.sh.erb b/templates/drupal.sh.erb
index 84843b8..06754c8 100644
--- a/templates/drupal.sh.erb
+++ b/templates/drupal.sh.erb
@@ -82,7 +82,12 @@ function drupal_iterate {
if [ "$1" != "cron" ] && [ "$SILENT" != "yes" ]; then
echo "Processing $drupal..."
fi
- drush -l $drupal $*
+
+ if [ "$1" == "update" && "$1" == "cron-update" ]; then
+ drupal_update $1 $drupal
+ else
+ drush -l $drupal $*
+ fi
fi
fi
done
@@ -97,6 +102,22 @@ function drupal_iterate {
done
}
+# Update a drupal instance
+function drupal_update {
+ local method="$1"
+ local instance="$2"
+ local pipe
+
+ if [ "$method" == "" ]; then
+ pipe="--pipe"
+ fi
+
+ # See https://drupal.org/node/823146#comment-3319070
+ # Also, avoid automated core updates
+ drush -l $instance up -u 1 --pipe | grep -v -E '^drupal|Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK' \
+ | cut -d " " -f1 | xargs drush up -u 1 -y $pipe
+}
+
# Deploy a fresh drupal tree
function drupal_deploy {
if [ -z "$1" ]; then
@@ -375,7 +396,7 @@ elif [ "$1" == "cron" ]; then
elif [ "$1" == "cron-update" ]; then
SILENT="yes"
drupal_iterate pm-refresh &> /dev/null
- drupal_iterate pm-update -y -p | grep -v -E 'Unknown|Up-to-date|Atualizado|Desconhecido|^Array$|^\($|^\)$|OK'
+ drupal_iterate pm-update
elif [ "$1" == "deploy" ]; then
shift
drupal_deploy $*