Method: VMC::Cli::TunnelHelper#tunnel_url

Defined in:
lib/cli/tunnel_helper.rb

#tunnel_url(infra) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cli/tunnel_helper.rb', line 44

def tunnel_url(infra)

  tun_url = tunnel_app_info(infra)[:uris][0]

  ["https", "http"].each do |scheme|
    url = "#{scheme}://#{tun_url}"
    begin
      RestClient.get(url)

    # https failed
    rescue Errno::ECONNREFUSED

    # we expect a 404 since this request isn't auth'd
    rescue RestClient::ResourceNotFound
      return url
    end
  end

  err "Cannot determine URL for #{tun_url}"
end