Alexandros Kosiaris has uploaded a new change for review.
https://gerrit.wikimedia.org/r/141951
Change subject: Sanitize nrpe::check title parameter
......................................................................
Sanitize nrpe::check title parameter
It is possible to use spaces inside the title param of nrpe::check.
$title is used however as the file name the corresponding nrpe
configuration file This has already resulted once in false alerts
and will probably do so again. Prevent this by sanitizing and munging
all non-alphanumeric characters from the file name
Change-Id: I8d813f316272024ef5f826139ac26824a00be6ce
---
M modules/nrpe/manifests/check.pp
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/51/141951/1
diff --git a/modules/nrpe/manifests/check.pp b/modules/nrpe/manifests/check.pp
index be0c2d7..a48380b 100644
--- a/modules/nrpe/manifests/check.pp
+++ b/modules/nrpe/manifests/check.pp
@@ -26,7 +26,8 @@
define nrpe::check($command, $ensure='present') {
# If the nrpe class is not included, this entire definition will never be
# realized making it a no-op
- @file { "/etc/nagios/nrpe.d/${title}.cfg":
+ $title_safe = regsubst($title, '[\W]', '-', 'G')
+ @file { "/etc/nagios/nrpe.d/${title_safe}.cfg":
ensure => $ensure,
owner => 'root',
group => 'root',
--
To view, visit https://gerrit.wikimedia.org/r/141951
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d813f316272024ef5f826139ac26824a00be6ce
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits