Feature #393

foreman: report URL configuration.

Added by Mike Mestnik over 2 years ago. Updated 6 months ago.

Status:Rejected Start:09/30/2010
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Puppet integration
Target version:-
Backlog:No Difficulity:
Votes: 0

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

History

Updated by Ohad Levy over 2 years ago

  • Category set to Puppet integration
  • Target version set to 0.2
  • Backlog set to No

Updated by Ohad Levy about 2 years ago

  • Target version deleted (0.2)

Updated by Benjamin Papillon 6 months ago

  • Status changed from New to Rejected

Sorry, I'm closing this one. To quote one developer :
"requiring an edit to puppet's known settings to tell it about foreman is wrong"

Benjamin

Updated by Dominic Cleal 6 months ago

Requiring a new "foremanurl" setting to be added to Puppet to configure an external report processor is the wrong approach and wouldn't get merged into Puppet core.

The way we're doing this is through the puppet-foreman module in the installer, so the URL's configurable as a module param.

Also available in: Atom PDF