Ottomata has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366623 )

Change subject: Reload eventlogging-consumer mysql-eventbus if event-schemas 
change
......................................................................


Reload eventlogging-consumer mysql-eventbus if event-schemas change

This requires that https://gerrit.wikimedia.org/r/#/c/366614/ is merged and 
deployed.

Change-Id: I16596eb563dadd2abfdcec4dd998b0a1f0e22256
---
M modules/eventlogging/manifests/service/consumer.pp
M modules/role/manifests/eventlogging/analytics/mysql.pp
2 files changed, 30 insertions(+), 1 deletion(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved



diff --git a/modules/eventlogging/manifests/service/consumer.pp 
b/modules/eventlogging/manifests/service/consumer.pp
index 0cacb15..fe215e4 100644
--- a/modules/eventlogging/manifests/service/consumer.pp
+++ b/modules/eventlogging/manifests/service/consumer.pp
@@ -44,6 +44,12 @@
 # [*mode*]
 #   File permission mode of config file.  Default: 0644
 #
+# [*reload_on]
+#   Reload eventlogging-consumer if any of the provided Puppet
+#   resources have changed.  This should be an array of alreday
+#   declared puppet resources.  E.g.
+#   [File['/path/to/topicconfig.yaml'], Class['::something::else']]
+#
 # === Examples
 #
 #  eventlogging::service::consumer { 'all events':
@@ -60,15 +66,34 @@
     $owner        = 'root',
     $group        = 'root',
     $mode         = '0644',
+    $reload_on    = undef,
 ) {
+    # eventlogging-consumer puppetization currently only works on Ubuntu with 
upstart
+    if $::operatingsystem == 'Ubuntu' {
+        fail('eventlogging::service::consumer currently only works on Ubuntu 
with upstart.')
+    }
+
     Class['eventlogging::server'] -> Eventlogging::Service::Consumer[$title]
 
     $basename = regsubst($title, '\W', '-', 'G')
-    file { "/etc/eventlogging.d/consumers/${basename}":
+    $config_file = "/etc/eventlogging.d/consumers/${basename}"
+    file { $config_file:
         ensure  => $ensure,
         content => template('eventlogging/consumer.erb'),
         owner   => $owner,
         group   => $group,
         mode    => $mode,
     }
+
+    # Upstart specific reload command for this eventlogging consumer task.
+    $reload_cmd = "/sbin/reload eventlogging/consumer NAME=${basename} 
CONFIG=${config_file}"
+    # eventlogging-consumer can be SIGHUPed via reload.
+    # Note that this does not restart the service, so no
+    # events in flight should be lost.
+    # This will only happen if $reload_on is provided.
+    exec { "reload eventlogging-consumer-${basename}":
+        command     => $reload_cmd,
+        refreshonly => true,
+        subscribe   => $reload_on,
+    }
 }
diff --git a/modules/role/manifests/eventlogging/analytics/mysql.pp 
b/modules/role/manifests/eventlogging/analytics/mysql.pp
index 14ef321..c05b08b 100644
--- a/modules/role/manifests/eventlogging/analytics/mysql.pp
+++ b/modules/role/manifests/eventlogging/analytics/mysql.pp
@@ -112,5 +112,9 @@
         owner        => 'root',
         group        => 'eventlogging',
         mode         => '0640',
+        # The consumer will be reloaded (SIGHUPed, not restarted)
+        # if any of these resources change.
+        # Reload if mediawiki/event-schemas has a change.
+        reload_on    =>  Class['::eventschemas'],
     }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I16596eb563dadd2abfdcec4dd998b0a1f0e22256
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Mforns <[email protected]>
Gerrit-Reviewer: Nuria <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to