def fetch_endpoint(path)
uri = @baseurl + path
body = open(uri, :proxy => nil).read
parse_results(body)
rescue OpenURI::HTTPError => e
if e.message.match /404 Not Found/i
return nil
else
Facter.log_exception(e, "Failed to fetch ec2 uri #{uri}: #{e.message}")
return nil
end
rescue *CONNECTION_ERRORS => e
Facter.log_exception(e, "Failed to fetch ec2 uri #{uri}: #{e.message}")
return nil
rescue Timeout::Error => e
Facter.log_exception(e, "Failed to fetch ec2 uri #{uri}: #{e.message}")
return nil
end