Hi all,

After troubleshooting my foreman installation on the Foreman mailing
list (thanks Ohad!) I've come to the conclusion that the reason why
reports aren't being generated is that since I upgraded puppet master
from 0.24.x to 0.25.4, the "foreman" report is not running correctly
(if at all!).

The puppetmasterd is running as a Rack application and despite the
fact that puppetmasterd has the following in
/etc/puppet/puppetmasterd.conf

[puppetmasterd]
reports = log,foreman
storeconfigs = true

And that the report appears to be configured correctly (the actual
hostname is obscured but it resolves via DNS without issue):

[root@<host> reports]# pwd
/usr/lib/ruby/1.8/puppet/reports
[root@<host> reports]# ls
foreman.rb  log.rb  rrdgraph.rb  store.rb  tagmail.rb

and that foreman.rb appears to be correct:

# copy this file to your report dir - e.g. /usr/lib/ruby/1.8/puppet/reports/
# add this report in your puppetmaster reports - e.g, in your puppet.conf add:
# reports=log, foreman # (or any other reports you want)

# URL of your Foreman installation
$foreman_url="http://foreman.<host>:3000"

require 'puppet'
require 'net/http'
require 'uri'

Puppet::Reports.register_report(:foreman) do
    Puppet.settings.use(:reporting)
    desc "Sends reports directly to Foreman"

    def process
      begin
        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 at
#{$foreman_url}/reports/create?format=yml: #{e}"
      end
    end
end

and that the config.ru has been updated for puppetmaster 0.25.4:

# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
# $:.unshift('/opt/puppet/lib')

$0 = "puppetmasterd"
require 'puppet'

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"
require 'puppet/application/puppetmasterd'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Application[:puppetmasterd].run

I am not even seeing an attempt to run the foreman report.  Foreman is
working fine and is serving web pages, it was also working fine with
the reports up until the puppetmaster upgrade.

Can anyone help? I can provide more information if required.

PF

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to