Project

General

Profile

0001-Handle-HTTPS-report-submissions.patch

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

View differences:

extras/puppet/foreman/files/foreman-report.rb
15 15

  
16 16
    def process
17 17
      begin
18
        Net::HTTP.post_form(URI.parse("#{$foreman_url}/reports/create?format=yml"), {'report'=> to_yaml})
18
        uri = URI.parse($foreman_url)
19
        http = Net::HTTP.new(uri.host, uri.port)
20
        if uri.scheme == 'https' then
21
          http.use_ssl = true
22
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
23
        end
24
        req = Net::HTTP::Post.new("/reports/create?format=yml")
25
        req.set_form_data({'report' => to_yaml})
26
        response = http.request(req)
19 27
      rescue Exception => e
20
        raise Puppet::Error, "Could not send report to Foreman: #{e}"
28
        raise Puppet::Error, "Could not send report to Foreman at #{$foreman_url}/reports/create?format=yml: #{e}"
21 29
      end
22 30
    end
23 31
end
24
-