From 6e876f8a3c8cc2c3fa7ed48764efa890fc5d8098 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 20 Nov 2012 15:52:23 +0000 Subject: Default to a 200-status code check. --- lib/custodian/parser.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/custodian/parser.rb') diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index ce6ad1e..b7b4279 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -428,20 +428,23 @@ class MonitorConfig # # if ( test[:test_type] =~ /^https?/ ) - found = 0 + # + # If a status code is specified use it; otherwise default + # to 200. if ( line =~ /\s+with\s+status\s+([0-9]+)\s+/ ) - test[:http_status]=$1.dup - found += 1 + test[:http_status] = $1.dup + else + test[:http_status] = 200 end + + # + # If a content-check is in place then use it. + # 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 -- cgit v1.2.1