Dzahn has uploaded a new change for review.

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

Change subject: turn ircecho into a parameterized class
......................................................................

turn ircecho into a parameterized class

in I6e5d832c9 I moved the variables for
it out of the node level, so they are not set
in site.pp anymore but instead in a role class.

this was to make it a role that beta can apply
on labs

but as Alex pointed out there it introduced
a regression for puppet3 compat. as suggested,
turn ircecho into a parameterized class instead

Change-Id: Ic3bd7c82635dfd1c4c85ee18827f089527a87975
---
M manifests/role/echoirc.pp
M modules/ircecho/manifests/init.pp
M modules/ircecho/templates/default.erb
3 files changed, 21 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/76/129676/1

diff --git a/manifests/role/echoirc.pp b/manifests/role/echoirc.pp
index a82e768..5980397 100644
--- a/manifests/role/echoirc.pp
+++ b/manifests/role/echoirc.pp
@@ -19,7 +19,11 @@
         }
     }
 
-    include ircecho
+    class { '::ircecho':
+        ircecho_logs    => $ircecho_logs,
+        ircecho_nick    => $ircecho_nick,
+        $ircecho_server => $ircecho_server,
+   }
 
     # bug 26784 - IRC bots process need nagios monitoring
     nrpe::monitor_service { 'ircecho':
diff --git a/modules/ircecho/manifests/init.pp 
b/modules/ircecho/manifests/init.pp
index f9464f5..8e7b032 100644
--- a/modules/ircecho/manifests/init.pp
+++ b/modules/ircecho/manifests/init.pp
@@ -1,16 +1,18 @@
 # IRC echo class
-
-class ircecho {
-
-    # To use this class, you must define some variables; here's an example
-    # (leading hashes on channel names are added for you if missing):
-    #  $ircecho_logs = {
-    #    "/var/log/nagios/irc.log" =>
-    #    ["wikimedia-operations","#wikimedia-tech"],
-    #    "/var/log/nagios/irc2.log" => "#irc2",
-    #  }
-    #  $ircecho_nick = "nagios-wm"
-    #  $ircecho_server = "chat.freenode.net"
+# To use this class, you must define some parameters; here's an example
+# (leading hashes on channel names are added for you if missing):
+# $ircecho_logs = {
+#  "/var/log/nagios/irc.log" =>
+#  ["wikimedia-operations","#wikimedia-tech"],
+#  "/var/log/nagios/irc2.log" => "#irc2",
+# }
+# $ircecho_nick = "icinga-wm"
+# $ircecho_server = "chat.freenode.net"
+class ircecho (
+    $ircecho_logs,
+    $ircecho_nick,
+    $ircecho_server = 'chat.freenode.net',
+) {
 
     package { 'ircecho':
         ensure => present,
diff --git a/modules/ircecho/templates/default.erb 
b/modules/ircecho/templates/default.erb
index 4e933da..fbef16d 100644
--- a/modules/ircecho/templates/default.erb
+++ b/modules/ircecho/templates/default.erb
@@ -50,6 +50,6 @@
 # This is a POSIX shell fragment
 #
 INFILE="<%= infile(@ircecho_logs) %>"
-NICK="<%= @ircecho_nick %>"
+NICK="<%= scope.lookupvar('ircecho::ircecho_nick') %>"
 CHANS="<%= chans(@ircecho_logs) %>"
-SERVER="<%= @ircecho_server %>"
+SERVER="<%= scope.lookupvar('ircecho::ircecho_server') %>"

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

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

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

Reply via email to