Subject: | notes field does not support having a ';' in it |
If the notes field has a semi-colon listed in it, Nagios::Object strips
out the rest of the line (treating it as a comment). This hack is to
put the entire notes field back in.
When viewing the notes field content in the nagios app, the comment
character is displayed on the screen (not stripped out).
Not sure what other fields in nagios itself has this syntax (allowing
the comment character as a valid field content).
Subject: | perl-Nagios-Object-0.21.14-notes.patch |
--- ./lib/Nagios/Object/Config.pm.orig 2011-01-19 13:28:38.000000000 -0500
+++ ./lib/Nagios/Object/Config.pm 2011-02-24 12:52:44.000000000 -0500
@@ -268,16 +268,19 @@
# this is an attribute inside an object definition
elsif ($in_definition) {
$line =~ s/\s*;(.*)$//;
+ my $comment = $1;
# the comment stripped off of $line is saved in $1 due to the ()
# around .*, so it's saved in the object if supported
if ( !$fast_mode && $1 && $current->can('set_comment') ) {
- $current->set_comment($1);
+ $current->set_comment($comment);
}
my ( $key, $val ) = split( /\s+/, $line, 2 );
my $set_method = 'set_' . $key;
if ( $current->can($set_method) ) {
+ # Put back the comment if we have a notes key.
+ $val .= ';' . $comment if ( $key eq 'notes' && defined $comment );
$current->$set_method($val);
}
elsif ($strict_mode) {