]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Feat: drupal 9 support
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 21 Jul 2020 20:15:39 +0000 (17:15 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 21 Jul 2020 20:15:39 +0000 (17:15 -0300)
files/drupal
manifests/autoupgrade.pp
manifests/init.pp

index e43fd49b04db9c25308685e379bbd61412ac0da4..bc4b12f124ebe196067dc9529d5e05c1d7a67402 100755 (executable)
@@ -5,7 +5,8 @@
 
 BASE=${BASE:="/var/www/data"}
 SITES=${SITES:="$BASE/drupal"}
-SERIES="6 7 8"
+SERIES="6 7 8 9"
+LATEST_SERIES="9"
 
 # Ensure we have a proper path, useful when called through cron
 export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
@@ -152,7 +153,7 @@ function drupal_current {
   local series="$1"
 
   if [ -z "$series" ]; then
-    series="8"
+    series="$LATEST_SERIES"
   fi
 
   if [ -e "$BASE/drupal-${series}" ]; then
@@ -169,7 +170,7 @@ function drupal_latest {
   local series="$1"
 
   if [ -z "$series" ]; then
-    series="8"
+    series="$LATEST_SERIES"
   fi
 
   latest="`wget -O- -q https://updates.drupal.org/release-history/drupal/${series}.x | grep -oPm1 "(?<=<download_link>)[^<]+" | grep -v -- '-dev' | grep -v -- '-alpha' | grep -v -- '-beta' | grep -v -- '-rc' | head -1`"
@@ -188,7 +189,10 @@ function drupal_download {
   fi
 
   # Check for latest releases if no specific version was given
-  if [ "$new" == "8" ]; then
+  if [ "$new" == "9" ]; then
+    drupal_series="9"
+    new="`drupal_latest 9`"
+  elif [ "$new" == "8" ]; then
     drupal_series="8"
     new="`drupal_latest 8`"
   elif [ "$new" == "7" ]; then
@@ -237,7 +241,11 @@ function drupal_upgrade {
   new="$2"
 
   # Fix versions if just a series is given
-  if [ "$old" == "8" ] && [ -z "$new" ]; then
+  if [ "$old" == "9" ] && [ -z "$new" ]; then
+    old="`drupal_current 9`"
+    new="`drupal_latest  9`"
+    drupal_series="9"
+  elif [ "$old" == "8" ] && [ -z "$new" ]; then
     old="`drupal_current 8`"
     new="`drupal_latest  8`"
     drupal_series="8"
index 6aa881bc52b3c775a5bf266d25da92bcdaf8da8e..cd7a6d5bbe359ccb309be011faba6d58d815d9ea 100644 (file)
@@ -1,4 +1,17 @@
 class drupal::autoupgrade {
+  # Keep 9.x codebase updated
+  cron { "drupal-autoupgrade-9.x":
+    command     => "/usr/local/bin/drupal upgrade 9",
+    user        => root,
+    # Run once a week after security releases (usually on Wednesdays)
+    weekday     => 5,
+    hour        => "01",
+    minute      => "30",
+    environment => [ 'SILENT=yes' ],
+    ensure      => present,
+    require     => [ File['/usr/local/bin/drupal'], User['drupal'] ],
+  }
+
   # Keep 8.x codebase updated
   cron { "drupal-autoupgrade-8.x":
     command     => "/usr/local/bin/drupal upgrade 8",
index b81f23180a9f43c25f829df3783705c01aa6a7d8..96fc36d8d64c56026ac8eecf0bc37d86128fde1d 100644 (file)
@@ -66,6 +66,14 @@ class drupal {
     backup  => false,
   }
 
+  # Ensure we have an 9.x instance
+  exec { 'drupal-download-9.x':
+    command => '/usr/local/bin/drupal download 9',
+    user    => "root",
+    creates => '/var/www/data/drupal-9',
+    require => File['/usr/local/bin/drupal'],
+  }
+
   # Ensure we have an 8.x instance
   exec { 'drupal-download-8.x':
     command => '/usr/local/bin/drupal download 8',