diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-17 23:28:53 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-17 23:28:53 +0000 |
commit | eeaaca61a9fa9df24c422ebe229a6b9928f60f20 (patch) | |
tree | 2a64aad1eb7a558ba23c02d372f98236d10afe24 /lib | |
parent | 8d4f8df269045f61f3922dfb827a729b727f5307 (diff) |
WARN: The user if there is no status/content test for HTTP, or banner for TCP-tests.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/parser.rb | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index 88d81fc..f9fc89f 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -387,8 +387,12 @@ class MonitorConfig # # TCP-tests will include a banner, optionally # - if ( line =~ /\s+with\s+banner\s+'([^']+)'/ ) - test[:banner]=$1.dup + if ( test[:test_type] =~ /tcp/ ) + if ( line =~ /\s+with\s+banner\s+'([^']+)'/ ) + test[:banner]=$1.dup + else + puts "You did not specify a banner to match against in line: #{line}" + end end @@ -407,13 +411,24 @@ class MonitorConfig # http://example.vm/ must run http with status 200 and content 'OK'. # # - if ( line =~ /\s+with\s+status\s+([0-9]+)\s+/ ) - test[:http_status]=$1.dup - end - if ( line =~ /\s+with\s+content\s+'([^']+)'/ ) - test[:http_text]=$1.dup + if ( test[:test_type] =~ /^https?/ ) + found = 0 + + if ( line =~ /\s+with\s+status\s+([0-9]+)\s+/ ) + test[:http_status]=$1.dup + found += 1 + end + if ( line =~ /\s+with\s+content\s+'([^']+)'/ ) + test[:http_text]=$1.dup + found += 1 + end + + if ( found == 0 ) + puts "WARNING: Neither an expected text, or a status code, were specified in the line: #{line}" + end end + # # These are special cased for the DNS types # |