5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/services/foreman_rh_cloud/cloud_request.rb', line 5
def execute_cloud_request(params)
final_params = {
verify_ssl: ForemanRhCloud.verify_ssl_method,
proxy: ForemanRhCloud.transformed_http_proxy_string,
}.deep_merge(params)
if ForemanRhCloud.with_iop_smart_proxy?
final_params[:ssl_ca_file] ||= ForemanRhCloud.ca_cert
end
response = RestClient::Request.execute(final_params)
logger.debug("Response headers for request url #{final_params[:url]} are: #{response.headers}")
response
rescue RestClient::Exceptions::Timeout => ex
logger.debug("Timeout exception raised for request url #{final_params[:url]}: #{ex}")
raise
rescue RestClient::ExceptionWithResponse => ex
logger.debug("Response headers for request url #{final_params[:url]} with status code #{ex.http_code} are: #{ex.http_headers} and body: #{ex.http_body}")
raise
rescue StandardError => ex
logger.debug("Exception raised for request url #{final_params[:url]}: #{ex}")
raise
end
|