Actions
Feature #393
closedforeman: report URL configuration.
Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Puppet integration
Target version:
-
Description
--- /usr/share/foreman/extras/puppet/foreman/files/foreman-report.rb 2010-06-07 02:37:59.000000000 -0500 +++ files/foreman.rb 2010-09-30 13:40:07.000000000 -0500 @@ -3,8 +3,6 @@ # reports=log, foreman # (or any other reports you want) # URL of your Foreman installation -$foreman_url="http://foreman:3000" - require 'puppet' require 'net/http' require 'uri' @@ -15,17 +13,18 @@ def process begin - uri = URI.parse($foreman_url) + uri = URI.parse(Puppet[:foremanurl]) 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 = Net::HTTP::Post.new(Puppet[:foremanurl]+ + "/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 at #{$foreman_url}/reports/create?format=yml: #{e}" + raise Puppet::Error, "Could not send report to Foreman at #{Puppet[:foremanurl]}/reports/create?format=yml: #{e}" end end end
Changes also made to /usr/lib/ruby/1.8/puppet/defaults.rb though I can't say if these are necessary. After line 634 reporturl: "The URL used by the http reports processor to send reports"]
Put a ',' at the end of that line and add something like:
:foremanurl => ["http://localhost:3000/reports", "The URL used by the http reports processor to send reports"]
I didn't do anything more, but add this to my puppet master config section.
foremanurl = http://commestnik.local/foreman
Rather I added this to a template:
foremanurl = http://<%= puppetserver rescue "commestnik.local" %>/foreman
Actions