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" if @mydebug
while attempt < MAX_RETRIES
attempt += 1
if @mydebug
puts " Attempt # #{attempt}"
else
print CLEAR_LINE + "Confirming application '#{app_name}' is available: Attempt # #{attempt}"
end
$stdout.flush
url = URI.parse("http://#{fqdn}/#{health_check_path}")
sleep(2.0)
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 CLEAR_LINE + "Confirming application '#{app_name}' is available: Success!"
puts ""
puts "#{app_name} published: http://#{fqdn}/"
puts "git url: #{git_url}"
if @mydebug
unless no_git
puts "To make changes to '#{app_name}', commit to #{repo_dir}/."
else
puts "To make changes to '\#{app_name}', you must first clone it with:\n git clone \#{git_url}\n\n"
puts "Then run 'git push' to update your OpenShift space."
end
end
if result && !result.empty?
puts "#{result}"
end
return true
end
if !response.nil? && @mydebug
puts "Server responded with #{response.code}"
puts response.body unless response.code == '503'
end
puts " sleeping #{sleep_time} seconds" if @mydebug
sleep sleep_time
sleep_time = delay(sleep_time)
end
return false
end