def self.check_app_available(net_http, app_name, fqdn, health_check_path, result, git_url, repo_dir, no_git)
sleep_time = 2
attempt = 0
puts "Confirming application '#{app_name}' is available"
while attempt < MAX_RETRIES
attempt += 1
puts " Attempt # #{attempt}"
url = URI.parse("http://#{fqdn}/#{health_check_path}")
begin
response = net_http.get_response(url)
rescue Exception => e
response = nil
end
if !response.nil? && response.code == "200" && response.body[0,1] == "1"
puts "\nSuccess! Your application '\#{app_name}' is now published here:\n\n http://\#{fqdn}/\n\nThe remote repository is located here:\n\n \#{git_url}\n\n"
unless no_git
puts "To make changes to '\#{app_name}', commit to \#{repo_dir}/.\n"
else
puts "To make changes to '\#{app_name}', you must first clone it with:\n\n git clone \#{git_url}\n\n"
puts "Then run 'git push' to update your OpenShift Express space.\n\n"
end
if result && !result.empty?
puts "\n\#{result}\n \n"
end
return true
end
if !response.nil? && @mydebug
puts "Server responded with #{response.code}"
puts response.body unless response.code == '503'
end
puts
puts " sleeping #{sleep_time} seconds"
sleep sleep_time
sleep_time = delay(sleep_time)
end
return false
end