Jcrespo has submitted this change and it was merged.

Change subject: mariadb: Add the posibility of selecting other package versions
......................................................................


mariadb: Add the posibility of selecting other package versions

The previous puppetization only allowed mariadb10 => true/false,
which was not really too future-proof.

This deprecates that paramenter (but continues to use it) and
introduces a new one called package. In the future we could also
add a version to hold packages to a particular existing/old
version for programmed upgrades.

As of now, versions allowed are wmf-mariadb10, wmf-mariadb101,
and wmf-mysql57 (maybe in the future the class can be renamed
to something else).

Bug: T149422
Change-Id: Ieb392eb1733dfa9df57107978a0170bb3f3b35a5
---
M manifests/mysqld_safe.pp
M manifests/packages_wmf.pp
2 files changed, 43 insertions(+), 24 deletions(-)

Approvals:
  Jcrespo: Looks good to me, approved
  Marostegui: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/manifests/mysqld_safe.pp b/manifests/mysqld_safe.pp
index a31d777..23dcd36 100644
--- a/manifests/mysqld_safe.pp
+++ b/manifests/mysqld_safe.pp
@@ -1,10 +1,14 @@
-# Make /opt/wmf-mariadb10/bin/mysqld_safe managed by puppet. This allows us to 
make quick
-# changes to harden the wrapper without rebuilding the custom wmf-mariabd10 
package
-# Once all trusty dbs are gone, we can hopefully discard mysqld_safe in favour 
of a custom
+# Make /opt/wmf-mariadb10/bin/mysqld_safe managed by puppet.
+# This allows us to make quick changes to harden the wrapper
+# without rebuilding the custom wmf-mariabd10 package
+# Once all trusty dbs are gone, we can hopefully discard
+# mysqld_safe in favour of a custom
 # systemd service unit
-class mariadb::mysqld_safe {
+class mariadb::mysqld_safe(
+    $package = 'wmf-mariadb10',
+    ) {
 
-    file { '/opt/wmf-mariadb10/bin/mysqld_safe':
+    file { "/opt/${package}/bin/mysqld_safe":
         ensure => present,
         owner  => 'root',
         group  => 'mysql',
diff --git a/manifests/packages_wmf.pp b/manifests/packages_wmf.pp
index 2960649..5af9c01 100644
--- a/manifests/packages_wmf.pp
+++ b/manifests/packages_wmf.pp
@@ -1,40 +1,55 @@
 # MariaDB WMF patched build installed in /opt.
-# Unless you're setting up a production server, you probably want vanilla 
mariadb::packages
+# Unless you're setting up a production server,
+# you probably want vanilla mariadb::packages
 
 class mariadb::packages_wmf(
-    $mariadb10 = true,
+    $mariadb10 = true,        # deprecated parameter, do not use
+    $package   = 'wmf-mariadb10',
+#    $version   = None,          # reserved for future usage
     ) {
 
     package { [
-        'libaio1',
+        'libaio1',            # missing dependency on packages < 10.0.27
         'percona-toolkit',
         'percona-xtrabackup',
-        'libjemalloc1',
+        'libjemalloc1',       # missing dependency on packages < 10.0.27
         'pigz',
     ]:
         ensure => present,
     }
 
-    if ($mariadb10 == true) {
-
-        package { [
-            'wmf-mariadb10',
-        ]:
+    # mariadb10 parameter is deprecated, and it will be eliminates as soon
+    # as the last mariadb 5.5 server is upgraded
+    if ($mariadb10 == false) {
+        package { 'wmf-mariadb':
             ensure => present,
+        }
+        class { 'mariadb::mysqld_safe':
+            package => 'wmf-mariadb',
         }
     }
     else {
+        case $package {
+            'wmf-mariadb', 'wmf-mariadb10', 'wmf-mariadb101', 'wmf-mysql57' :
+            {
+                package { $package:
+                    ensure => present,
+                }
 
-        package { [
-            'wmf-mariadb',
-        ]:
-            ensure => present,
+                # 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 => $package,
+                }
+            }
+            default :
+            {
+                fail("Invalid package version \"${package}\". \
+The only allowed versions are: wmf-mariadb10, wmf-mariadb101 or wmf-mysql57")
+            }
         }
     }
-
-    # 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
-    include mariadb::mysqld_safe
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieb392eb1733dfa9df57107978a0170bb3f3b35a5
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet/mariadb
Gerrit-Branch: master
Gerrit-Owner: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Marostegui <maroste...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to