Dzahn has submitted this change and it was merged.

Change subject: monitoring: replace illegal chars in description
......................................................................


monitoring: replace illegal chars in description

we've been bitten by this multiple times, with invalid icinga configuration
being generated and much pulling of hair

Bug: T101799
Change-Id: Ifd2ae22206b759380579b2abac55aae67b490022
---
M modules/monitoring/manifests/service.pp
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/monitoring/manifests/service.pp 
b/modules/monitoring/manifests/service.pp
index a56e733..b8f8d32 100644
--- a/modules/monitoring/manifests/service.pp
+++ b/modules/monitoring/manifests/service.pp
@@ -14,6 +14,10 @@
     $config_dir            = '/etc/nagios',
 )
 {
+    # the list of characters is the default for illegal_object_name_chars
+    # nagios/icinga option
+    $description_safe = regsubst($description, '[`~!$%^&*"|\'<>?,()=]', '-', 
'G')
+
     if ! $host {
         fail("Parameter ${host} not defined!")
     }
@@ -59,7 +63,7 @@
         target                 => "${config_dir}/puppet_checks.d/${host}.cfg",
         host_name              => $host,
         servicegroups          => $servicegroups,
-        service_description    => $description,
+        service_description    => $description_safe,
         check_command          => $check_command,
         max_check_attempts     => $retries,
         normal_check_interval  => $normal_check_interval,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd2ae22206b759380579b2abac55aae67b490022
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[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