Module: VirtualMonkey::UnifiedApplication
- Included in:
- ApplicationFrontend, ELBRunner, LampRunner
- Defined in:
- lib/virtualmonkey/unified_application.rb
Instance Method Summary collapse
-
#run_unified_application_check(dns_name, port = 8000) ⇒ Object
this is where ALL the generic application server checks live, this could get rather long but for now it’s a single method with a sequence of checks.
- #run_unified_application_checks(run_on = @servers, port = 8000) ⇒ Object
-
#test_http_response(expected_string, url, port) ⇒ Object
returns true if the http response contains the expected_string * url<~String> url to perform http request * expected_string<~String> regex compatible string used to match against the response output.
Instance Method Details
#run_unified_application_check(dns_name, port = 8000) ⇒ Object
this is where ALL the generic application server checks live, this could get rather long but for now it’s a single method with a sequence of checks
31 32 33 34 35 36 37 |
# File 'lib/virtualmonkey/unified_application.rb', line 31 def run_unified_application_check(dns_name, port=8000) url_base = "#{dns_name}:#{port}" behavior(:test_http_response, "html serving succeeded", "#{url_base}/index.html", port) behavior(:test_http_response, "configuration=succeeded", "#{url_base}/appserver/", port) behavior(:test_http_response, "I am in the db", "#{url_base}/dbread/", port) behavior(:test_http_response, "hostname=", "#{url_base}/serverid/", port) end |
#run_unified_application_checks(run_on = @servers, port = 8000) ⇒ Object
24 25 26 27 28 |
# File 'lib/virtualmonkey/unified_application.rb', line 24 def run_unified_application_checks(run_on=@servers, port=8000) run_on.each do |server| behavior(:run_unified_application_check, server.dns_name, port) end end |
#test_http_response(expected_string, url, port) ⇒ Object
returns true if the http response contains the expected_string
-
url<~String> url to perform http request
-
expected_string<~String> regex compatible string used to match against the response output
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/virtualmonkey/unified_application.rb', line 6 def test_http_response(expected_string, url, port) cmd = "curl -s #{url} 2> /dev/null " puts cmd timeout=300 begin status = Timeout::timeout(timeout) do while true response = `#{cmd}` break if response.include?(expected_string) puts "Retrying..." sleep 5 end end rescue Timeout::Error => e raise "ERROR: Query failed after #{timeout/60} minutes." end end |