Jcrespo has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371450 )

Change subject: mariadb: Remove package hacks for MariaDB 10.1 on jessie
......................................................................

mariadb: Remove package hacks for MariaDB 10.1 on jessie

Packages for jessie have been added with systemd support (10.1).
Init.d hacks (mysqld_safe override, init support) have to be only
maintained for 10.0 or below on jessie or below. Jessie with 10.1
or stretch (which has 10.1 as the minimum version) suport systemd
already.

Similar support for MySQL, starting from 5.7.

Bug: T116903
Bug: T145378
Change-Id: I751a8bd1334acd28bec34c4c00dc2478e033d9a0
---
M modules/mariadb/manifests/packages_wmf.pp
M modules/mariadb/manifests/service.pp
2 files changed, 50 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/50/371450/1

diff --git a/modules/mariadb/manifests/packages_wmf.pp 
b/modules/mariadb/manifests/packages_wmf.pp
index e3cecf7..fe40ae4 100644
--- a/modules/mariadb/manifests/packages_wmf.pp
+++ b/modules/mariadb/manifests/packages_wmf.pp
@@ -45,25 +45,28 @@
         }
 
         case $mariadb_package {
-            'wmf-mariadb', 'wmf-mariadb10', 'wmf-mariadb101', 'wmf-mysql57' :
+            'wmf-mariadb101', 'wmf-mariadb102', 'wmf-mysql57', 'wmf-mysql80':
+            {
+                require_package( $mariadb_package )
+            }
+            'wmf-mariadb', 'wmf-mariadb10':
             {
                 require_package( $mariadb_package )
 
-                if !os_version('debian >= stretch') {
-                    # if you have installed the wmf mariadb package,
-                    # create a custom, safer mysqld_safe
-                    # New packages include it, but old packages have
-                    # to be overwritten still - do not retire at least
-                    # until version > 10.0.27
-                    class { 'mariadb::mysqld_safe':
-                        package => $mariadb_package,
-                    }
+                # if you have installed a non-systemd compatible package,
+                # create a custom, safer mysqld_safe
+                # New packages include it, but old packages have
+                # to be overwritten still - do not take out at least
+                # until all hosts are on version > 10.0.27
+                class { 'mariadb::mysqld_safe':
+                    package => $mariadb_package,
                 }
             }
             default :
             {
                 fail("Invalid package version \"${mariadb_package}\". \
-The only allowed versions are: wmf-mariadb10, wmf-mariadb101 or wmf-mysql57")
+The only allowed versions are: wmf-mariadb10, wmf-mariadb101, wmf-mariadb102, \
+wmf-mysql57 or wmf-mysql80")
             }
         }
     }
diff --git a/modules/mariadb/manifests/service.pp 
b/modules/mariadb/manifests/service.pp
index 7f9224f..ea3fc79 100644
--- a/modules/mariadb/manifests/service.pp
+++ b/modules/mariadb/manifests/service.pp
@@ -1,8 +1,8 @@
 # Make /etc/init/mysql managed by puppet. This allows us to make quick
 # changes to harden the wrapper without rebuilding the custom wmf-mariadb10
 # package
-# Once all trusty dbs are gone, we can hopefully discard init.d in favour
-# of a custom systemd service unit
+# Once all trusty dbs and jessies with 10.0 are gone, we can hopefully
+# discard init.d in favour of the package systemd service unit
 #
 # Default behavior is for the service to be unmanaged and manually
 # started/stopped.
@@ -22,19 +22,39 @@
     $override = false,
     ) {
 
-    # stretch and later use systemd, others use init.d
-    if os_version('debian >= stretch') {
-        # On stretch+, default to MariaDB 10.1
-        if $package == 'undefined' {
-            $installed_package = 'wmf-mariadb101'
-        } else {
-            $installed_package = $package
-        }
-        case $installed_package {
-            'wmf-mysql57', 'wmf-mysql80': { $vendor = 'mysql' }
-            default:                      { $vendor = 'mariadb' }
-        }
+    # default strech to mariadb 10.1, others to 10.0
+    if os_version('debian >= stretch') && $package == 'undefined' {
+        $installed_package = 'wmf-mariadb101'
+    } elsif $package == 'undefined' {
+        $installed_package = 'wmf-mariadb10'
+    } else {
+        $installed_package = $package
+    }
 
+    # mariadb 10.1 and later use systemd, others use init.d
+    # Also identify vendor
+
+    case $installed_package {
+        'wmf-mariadb', 'wmf-mariadb10': { 
+            $systemd = false
+            $vendor  = 'mariadb'
+        }
+        'wmf-mariadb101', 'wmf-mariadb102', 'wmf-mariadb103': {
+            $systemd = true
+            $vendor  = 'mariadb'
+        }
+        'wmf-mysql57', 'wmf-mysql80': {
+            $systemd = true
+            $vendor = 'mysql'
+        }
+        'wmf-mysql56': {
+            $systemd = false
+            $vendor = 'mysql'
+        }
+    }
+
+    if $systemd {
+        # TODO: use the base::service configuration
         if $manage {
             service { $vendor:
                 ensure  => $ensure,
@@ -73,14 +93,9 @@
                 ensure => absent,
             }
         }
-    } else {
-        # Before stretch, default to MariaDB 10.0
-        if $package == 'undefined' {
-            $installed_package = 'wmf-mariadb10'
-        } else {
-            $installed_package = $package
-        }
 
+    } else {
+        # using still init.d
         if $basedir == 'undefined' {
             $initd_basedir = "/opt/${installed_package}"
         } else {
@@ -116,5 +131,4 @@
             }
         }
     }
-
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/371450
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I751a8bd1334acd28bec34c4c00dc2478e033d9a0
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <jcre...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to