Faidon Liambotis has submitted this change and it was merged.

Change subject: redis: Get rid of unused (and unhelpful) module parameters
......................................................................


redis: Get rid of unused (and unhelpful) module parameters

* Get rid of 'package', 'package_version', 'service_name' and 'config_template'
  arguments -- they were all unused.
* Don't alias 'redis-server' to 'redis' -- it just adds misdirection.
* Get rid of OS guards in redis module. The module is WMF-specific and not
  likely to be reusable by third parties, so there's no need to assert that the
  OS is Ubuntu or Debian.

Change-Id: I4e6a7fbb2b98d8f01d6ad02c4d4a5e631f3af320
---
M manifests/role/abacist.pp
M manifests/role/xenon.pp
M modules/dynamicproxy/manifests/api.pp
M modules/dynamicproxy/manifests/init.pp
M modules/redis/manifests/init.pp
M modules/redis/templates/redis.conf.erb
6 files changed, 18 insertions(+), 31 deletions(-)

Approvals:
  Filippo Giunchedi: Looks good to me, but someone else must approve
  Faidon Liambotis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/abacist.pp b/manifests/role/abacist.pp
index dd48fc4..25c74da 100644
--- a/manifests/role/abacist.pp
+++ b/manifests/role/abacist.pp
@@ -12,5 +12,5 @@
         eventlogging_publisher => 'tcp://vanadium.eqiad.wmnet:8600',
     }
 
-    Service['redis'] ~> Service['abacist']
+    Service['redis-server'] ~> Service['abacist']
 }
diff --git a/manifests/role/xenon.pp b/manifests/role/xenon.pp
index 374433d..399671c 100644
--- a/manifests/role/xenon.pp
+++ b/manifests/role/xenon.pp
@@ -16,7 +16,7 @@
         redis_replication => undef,
     }
 
-    Service['redis'] ~> Service['xenon-log']
+    Service['redis-server'] ~> Service['xenon-log']
 
     file { '/srv/xenon/theme':
         ensure  => directory,
diff --git a/modules/dynamicproxy/manifests/api.pp 
b/modules/dynamicproxy/manifests/api.pp
index db9b290..d4b5b3f 100644
--- a/modules/dynamicproxy/manifests/api.pp
+++ b/modules/dynamicproxy/manifests/api.pp
@@ -14,7 +14,7 @@
     }
 
     generic::upstart_job{ 'dynamicproxy-api':
-        require => Package['python-invisible-unicorn', 
'python-flask-sqlalchemy', 'redis', 'python-flask', 'uwsgi', 
'uwsgi-plugin-python'],
+        require => Package['python-invisible-unicorn', 
'python-flask-sqlalchemy', 'redis-server', 'python-flask', 'uwsgi', 
'uwsgi-plugin-python'],
         install => true,
         start   => true,
     }
diff --git a/modules/dynamicproxy/manifests/init.pp 
b/modules/dynamicproxy/manifests/init.pp
index 71aa1b7..e618238 100644
--- a/modules/dynamicproxy/manifests/init.pp
+++ b/modules/dynamicproxy/manifests/init.pp
@@ -31,7 +31,7 @@
     # The redis module intentionally does not restart the redis
     # service if the configuration changes, so we have to do this
     # explicitly here.
-    File['/etc/redis/redis.conf'] ~> Service['redis']
+    File['/etc/redis/redis.conf'] ~> Service['redis-server']
 
     include misc::labsdebrepo
 
diff --git a/modules/redis/manifests/init.pp b/modules/redis/manifests/init.pp
index f40950f..621e755 100644
--- a/modules/redis/manifests/init.pp
+++ b/modules/redis/manifests/init.pp
@@ -1,4 +1,3 @@
-# application server base class
 class redis (
     $port = 6379,
     $dir = '/srv/redis',
@@ -9,28 +8,15 @@
     $redis_options = {},
     $rename_commands = {},
     $redis_replication = undef,
-    $package = 'redis-server',
-    $package_version = 'present',
-    $servicename = 'redis-server',
     $monitor = true,
     $password = false,
     $auto_aof_rewrite_min_size = '512mb',
-    $config_template = 'redis/redis.conf.erb',
     $dbfilename = undef, # filename for rdb. If undef, "$hostname-$port.rdb" 
is used
     $saves = [ "900 1", "300 100", "60 10000" ], # Save points for rdb
     $stop_writes_on_bgsave_error = false
 ) {
-    case $::operatingsystem {
-        debian, ubuntu: {
-        }
-        default: {
-            fail("Module ${module_name} is not supported on 
${::operatingsystem}")
-        }
-    }
-
-    package { 'redis':
-        ensure => $package_version,
-        name   => $package,
+    package { 'redis-server':
+        ensure => present,
     }
 
     file { $dir:
@@ -38,29 +24,27 @@
         owner   => 'redis',
         group   => 'redis',
         mode    => '0755',
-        require => Package['redis'],
+        require => Package['redis-server'],
     }
 
     file { '/etc/redis/redis.conf':
-        content => template($config_template),
-        mode    => '0444',
+        content => template('redis/redis.conf.erb'),
         owner   => 'root',
         group   => 'root',
-        require => Package['redis'],
+        mode    => '0444',
+        require => Package['redis-server'],
     }
 
-    service { 'redis':
+    service { 'redis-server':
         ensure  => running,
-        name    => $servicename,
         enable  => true,
         require => File['/etc/redis/redis.conf'],
-        # subscribe => not doing this deliberately
     }
 
-    if $::lsbdistcodename == 'trusty' {
+    if os_version('ubuntu >= trusty || debian >= jessie') {
         # Upon a config change, Redis will be restarted
         # if it's listening on localhost only, see RT 7583
-        exec {'Restart redis if needed':
+        exec { 'Restart redis if needed':
             command     => '/usr/sbin/service redis-server restart',
             unless      => '/bin/netstat -lp | /bin/grep redis | /usr/bin/awk 
\'{print $4}\' | /bin/grep -v localhost 2> /dev/null',
             subscribe   => File['/etc/redis/redis.conf'],
@@ -69,6 +53,9 @@
     }
 
     if $monitor {
-        monitoring::service { $servicename: description => "Redis", 
check_command => "check_tcp!${port}" }
+        monitoring::service { 'redis-server':
+            description   => 'Redis',
+            check_command => "check_tcp!${port}",
+        }
     }
 }
diff --git a/modules/redis/templates/redis.conf.erb 
b/modules/redis/templates/redis.conf.erb
index c988c67..0670bd7 100644
--- a/modules/redis/templates/redis.conf.erb
+++ b/modules/redis/templates/redis.conf.erb
@@ -18,7 +18,7 @@
 
 # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
 # default. You can specify a custom pid file location here.
-pidfile /var/run/redis/<%= @servicename %>.pid
+pidfile /var/run/redis/redis-server.pid
 
 # Accept connections on the specified port, default is 6379.
 # If port 0 is specified Redis will not listen on a TCP socket.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e6a7fbb2b98d8f01d6ad02c4d4a5e631f3af320
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to