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 | 6aa7d400a8b519ba090a9d52ffb00051af3be5cb (patch) | |
tree | 2a64aad1eb7a558ba23c02d372f98236d10afe24 /lib/custodian/parser.rb | |
parent | c5c74fb557d825f9a8b67c51cfeeb5a48adfc6c0 (diff) |
WARN: The user if there is no status/content test for HTTP, or banner for TCP-tests.
Diffstat (limited to 'lib/custodian/parser.rb')
-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 # |