On Wed, 27 Aug 2014 05:31:39 -0700 (PDT)
Brian Wilkins <[email protected]> wrote:

> I am having to escape a regular expression in my match and puppet
> complains on the puppetmaster of an "Unrecognised escape sequence".
> How do I fix this so the logs don't get cluttered with this message?
> I am using Puppet 3.6.2.
> 
>  file_line { "nagios_monitor_check_${title}":
>     path   => '/etc/nagios/nrpe.cfg',
>     line   => 
> "command[check_${title}]=/usr/lib64/nagios/plugins/check_procs 
> ${proc_check} ${proc_count}",
>     match  => "^command\[check_${title}\]=.*",
>     notify => Service[nrpe],
>   }

Shot in the dark : Have you tried with two backslashes '\\' ? Because
since you're interpolating $title and have double quotes, it could be
needed to get the regexp string to contain a single backslash.

Also, but why not manage multiple files in /etc/nagios/nrpe.d/ based on
templates instead of managing a single file, since that's much trickier?

Another useless note : You don't need the '.*' at the end of your regexp
if you're not ending it with '$'.

Last useless note : I have also encountered problems with the file_line
'match' parameter, the first one being that the official example is
broken as the 'line' must match the 'match' regexp.

Good luck :-)

Matthias

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20140827170749.2b830610%40saou.eu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to