summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/custodian/parser.rb6
-rwxr-xr-xt/test-parser.rb4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb
index ea25c3a..045711d 100644
--- a/lib/custodian/parser.rb
+++ b/lib/custodian/parser.rb
@@ -146,7 +146,7 @@ class MonitorConfig
#
# Get the name of the macro.
#
- name = $1.dup if ( line =~ /^([1-2A-Z_]+)\s+/ )
+ name = $1.dup if ( line =~ /^([0-9A-Z_]+)\s+/ )
#
@@ -257,7 +257,7 @@ class MonitorConfig
elsif ( line =~ /^([0-9A-Z_]+)\s+(is|are)\s+/ )
define_macro( line )
- elsif ( line =~ /(.*)\s+must\s+ping(.*)/ )
+ elsif ( line =~ /^(\S+)\s+must\s+ping(.*)/ )
#
# Ping is a special case because the configuration file entry
@@ -280,7 +280,7 @@ class MonitorConfig
new_line = "#{pre} must run ping #{post}"
return( parse_line( new_line ) )
- elsif ( line =~ /\s+must\s+run\s+([^\s]+)(\s+|\.|$)/i )
+ elsif ( line =~ /^\S+\s+must\s+run\s+([^\s]+)(\s+|\.|$)/i )
#
# Get the service we're testing, and remove any trailing "."
diff --git a/t/test-parser.rb b/t/test-parser.rb
index cb9a9cb..a3b7b43 100755
--- a/t/test-parser.rb
+++ b/t/test-parser.rb
@@ -318,7 +318,7 @@ class TestParser < Test::Unit::TestCase
#
# Define a new macro, and ensure it is now present
#
- parser.parse_line( "FRONTLINESTAGING2 is 89.16.186.138 and 89.16.186.139 and 89.16.186.148." )
+ parser.parse_line( "FRONTLINESTAGING29 is 89.16.186.138 and 89.16.186.139 and 89.16.186.148." )
macros = parser.macros
assert( macros.size() == 1 )
@@ -327,7 +327,7 @@ class TestParser < Test::Unit::TestCase
# Test that we got a suitable value when lookup up the contents
# of that newly defined macro.
#
- values = parser.get_macro_targets( "FRONTLINESTAGING2" )
+ values = parser.get_macro_targets( "FRONTLINESTAGING29" )
assert(values.class.to_s == "Array" )