Giuseppe Lavagetto has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/202366

Change subject: analytics: correctly define dependencies
......................................................................

analytics: correctly define dependencies

With the current code, inverting the order of inclusion of a
role::analytics::hadoop::* class and that of standard would affect
installation of the ganglia diskstat plugin. This patch corrects that
behaviour and also achieves DRY.

Change-Id: Ibb2d122fb5f8f31b5f02a0ecf7bfcb9d13ab99f4
---
M manifests/role/analytics.pp
M manifests/role/analytics/hadoop.pp
M manifests/role/analytics/kafka.pp
3 files changed, 16 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/66/202366/1

diff --git a/manifests/role/analytics.pp b/manifests/role/analytics.pp
index 8dda6d0..e4e88ef 100644
--- a/manifests/role/analytics.pp
+++ b/manifests/role/analytics.pp
@@ -64,6 +64,18 @@
 
 }
 
+# == Class role::analytics::hadoop::monitor_disks
+# Installs monitoring plugins for disks
+#
+class role::analytics::monitor_disks {
+    if hiera('has_ganglia', true) {
+        ganglia::plugin::python { 'diskstat':
+            require => Service['ganglia-monitor']
+        }
+    }
+
+}
+
 # == Class role::analytics::password::research
 # Install the researcher MySQL username and password
 # into a file and make it readable by analytics-privatedata-users
diff --git a/manifests/role/analytics/hadoop.pp 
b/manifests/role/analytics/hadoop.pp
index b54ad18..e7d7f59 100644
--- a/manifests/role/analytics/hadoop.pp
+++ b/manifests/role/analytics/hadoop.pp
@@ -285,8 +285,6 @@
     }
 }
 
-
-
 # == Class role::analytics::hadoop
 # Installs Hadoop client pacakges and configuration.
 #
@@ -451,9 +449,7 @@
     }
 
     # monitor disk statistics
-    if defined(Service['ganglia-monitor']) and 
!defined(Ganglia::Plugin::Python['diskstat']) {
-        ganglia::plugin::python { 'diskstat': }
-    }
+    include role::analytics::monitor_disks
 
     # FairScheduler is creating event logs in hadoop.log.dir/fairscheduler/
     # It rotates them but does not delete old ones.  Set up cronjob to
@@ -529,10 +525,7 @@
     }
 
     # monitor disk statistics
-    if defined(Service['ganglia-monitor']) and 
!defined(Ganglia::Plugin::Python['diskstat']) {
-        ganglia::plugin::python { 'diskstat': }
-    }
-
+    include role::analytics::monitor_disks
 
     # Include icinga alerts if production realm.
     if $::realm == 'production' {
@@ -594,9 +587,7 @@
     }
 
     # monitor disk statistics
-    if defined(Service['ganglia-monitor']) and 
!defined(Ganglia::Plugin::Python['diskstat']) {
-        ganglia::plugin::python { 'diskstat': }
-    }
+    include role::analytics::monitor_disks
 
     # Include icinga alerts if production realm.
     if $::realm == 'production' {
diff --git a/manifests/role/analytics/kafka.pp 
b/manifests/role/analytics/kafka.pp
index 4690035..d2c1a2f 100644
--- a/manifests/role/analytics/kafka.pp
+++ b/manifests/role/analytics/kafka.pp
@@ -259,8 +259,6 @@
         }
 
         # monitor disk statistics
-        if !defined(Ganglia::Plugin::Python['diskstat']) {
-            ganglia::plugin::python { 'diskstat': }
-        }
+        include role::analytics::monitor_disks
     }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb2d122fb5f8f31b5f02a0ecf7bfcb9d13ab99f4
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>

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

Reply via email to