FAQ
This is more of a ruby programming question I think but here goes.

I would like to load a report from a file for some processing that does not
happen on the puppet master:

#!/usr/bin/env ruby
require 'yaml'
require 'puppet'

report = YAML::load(File.open('/var/lib/puppet/state/last_run_report.yaml',
'r'))

Puppet::Reports.register_report(:myreport) do
def process
if self.status == 'failed'
msg = "failed puppet run for #{self.host} #{self.status}"
else
msg = "puppet run for #{self.host} #{self.status}"
end
end
end

I am not sure that using the register report method is the proper way to go
as this is how you do custom reporting from the master. I have been
looking around in the puppet code for a way to get the report yaml into the
puppet reports class. What is the class and method that I cannot find?

Chris

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

Search Discussions

  • Felix Frank at Mar 5, 2013 at 12:23 pm
    Hi,

    disclaimer: I know next to nothing about ruby, and have not dabbled in
    many parts of the puppet code base. However :-)

    Since you YAML::loaded the serialized object, in your report variable is
    a perfectly fine instance of Puppet::Reports, for you to inspect and
    deal with as you please.
    What more would you like the puppet code to do with that?

    Cheers,
    Felix
    On 03/05/2013 04:49 AM, cblument@gmail.com wrote:
    This is more of a ruby programming question I think but here goes.

    I would like to load a report from a file for some processing that does
    not happen on the puppet master:

    #!/usr/bin/env ruby
    require 'yaml'
    require 'puppet'

    report =
    YAML::load(File.open('/var/lib/puppet/state/last_run_report.yaml', 'r'))

    Puppet::Reports.register_report(:myreport) do
    def process
    if self.status == 'failed'
    msg = "failed puppet run for #{self.host} #{self.status}"
    else
    msg = "puppet run for #{self.host} #{self.status}"
    end
    end
    end

    I am not sure that using the register report method is the proper way to
    go as this is how you do custom reporting from the master. I have been
    looking around in the puppet code for a way to get the report yaml into
    the puppet reports class. What is the class and method that I cannot find?

    Chris
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 5, '13 at 3:49a
activeMar 5, '13 at 12:23p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Felix Frank: 1 post Cblument: 1 post

People

Translate

site design / logo © 2022 Grokbase