Project

General

Profile

Feature #104 ยป 0001-Handle-HTTPS-report-submissions.patch

Frank Sweetser, 12/01/2009 03:42 PM

View differences:

extras/puppet/foreman/files/foreman-report.rb
def process
begin
Net::HTTP.post_form(URI.parse("#{$foreman_url}/reports/create?format=yml"), {'report'=> to_yaml})
uri = URI.parse($foreman_url)
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == 'https' then
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
req = Net::HTTP::Post.new("/reports/create?format=yml")
req.set_form_data({'report' => to_yaml})
response = http.request(req)
rescue Exception => e
raise Puppet::Error, "Could not send report to Foreman: #{e}"
raise Puppet::Error, "Could not send report to Foreman at #{$foreman_url}/reports/create?format=yml: #{e}"
end
end
end
    (1-1/1)