On Tue, Sep 28, 2010 at 9:29 AM, Douglas Garstang <doug.garst...@gmail.com> wrote: > Has anyone got/seen Python code to read puppet reports? > I added a bunch of these: > class PuppetReport(yaml.YAMLObject): > yaml_tag = u'!ruby/object:Puppet::Transaction::Report' > def __init__(self, host, logs, metrics, records, time): > self.host = host > self.logs = logs > self.metrics = metrics > self.records = records > self.time = time > However, the Python YAML parser fails with: > "yaml.constructor.ConstructorError: expected a mapping node, but found > scalar" > On the ruby/sym line: > !ruby/sym config_retrieval: 0.853000164031982 > I don't know how to define the classes to accept a scalar data type rather > than a mapping node data type, and Mr Google is giving me ZERO answers.
Huh. This must have changed, as I was doing it in exactly the same way. Is that actually from an old list message of mine? I think you've misread the error message. It basically doesn't know what to do with !ruby/sym at all. It may turn out nowadays to be simpler to do the parsing in Ruby and loading the puppet libraries so you get all this for free. I'll have a poke around and see if I can work out how to coerce !ruby/sym to something Python can understand. > Doug. > > -- > 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. > -- 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.