Hey there, I''ve playing with parsing some of the yaml data that puppet creates. Has anyone had luck doing this with python or the like? It seems that in every yaml file, there is a comment at the top of the file like this.. --- !ruby/object:Puppet::Node Which doesn''t make may yaml parsers happy.. where am I going wrong? --Luke Baker -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi Luke, Thats a dump of a ruby object in yaml, meaning that if you would like to restore the object (and its methods) you would need to run it in ruby and load the puppet libraries. what are you trying to achieve? there are a few examples out there already. Ohad On Sat, May 22, 2010 at 12:44 PM, Baker, Luke Jefferson < BakerLu@missouri.edu> wrote:> Hey there, > > > > I’ve playing with parsing some of the yaml data that puppet creates. Has > anyone had luck doing this with python or the like? It seems that in every > yaml file, there is a comment at the top of the file like this.. > > > > --- !ruby/object:Puppet::Node > > > > Which doesn’t make may yaml parsers happy.. where am I going wrong? > > > > --Luke Baker > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
You can load it in Python, you just need to do a bit more extra work first. I can get you an example on Monday or whenever Comcast fix my home internet connection... On Sat, May 22, 2010 at 12:43 AM, Ohad Levy <ohadlevy@gmail.com> wrote:> Hi Luke, > > Thats a dump of a ruby object in yaml, meaning that if you would like to > restore the object (and its methods) you would need to run it in ruby and > load the puppet libraries. > > what are you trying to achieve? there are a few examples out there already. > > Ohad > > > On Sat, May 22, 2010 at 12:44 PM, Baker, Luke Jefferson < > BakerLu@missouri.edu> wrote: > >> Hey there, >> >> >> >> I’ve playing with parsing some of the yaml data that puppet creates. Has >> anyone had luck doing this with python or the like? It seems that in every >> yaml file, there is a comment at the top of the file like this.. >> >> >> >> --- !ruby/object:Puppet::Node >> >> >> >> Which doesn’t make may yaml parsers happy.. where am I going wrong? >> >> >> >> --Luke Baker >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- nigel -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, May 21, 2010 at 9:44 PM, Baker, Luke Jefferson <BakerLu@missouri.edu> wrote:> Hey there, > > > > I’ve playing with parsing some of the yaml data that puppet creates. Has > anyone had luck doing this with python or the like? It seems that in every > yaml file, there is a comment at the top of the file like this.. > > > > --- !ruby/object:Puppet::Node > > > > Which doesn’t make may yaml parsers happy.. where am I going wrong? > > >Hopefully this is enough to get you started. I''ve been meaning to write up a blog post on this, so I might try and get that done soon. You need to set up some stub objects so Python knows what to do with them, like: 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 class PuppetLog(yaml.YAMLObject): yaml_tag = u''!ruby/object:Puppet::Util::Log'' def __init__(self, source, message, tags, time, level): self.source = source self.message = message self.tags = tags self.time = time self.level = level class PuppetMetric(yaml.YAMLObject): yaml_tag = u''!ruby/object:Puppet::Util::Metric'' def __init__(self, values, name, label): self.values = values self.name = name self.label = label Then when you read the yaml file, Python will consider !ruby/object:Puppet::Util::Metric to be a PuppetMetric class. This may not be complete even for these objects, but I tend to just iterate until I''ve got all the data I need. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Where did this go? On Friday, May 21, 2010 9:44:33 PM UTC-7, Luke Baker wrote:> Hey there, > > > > I’ve playing with parsing some of the yaml data that puppet creates. Has > anyone had luck doing this with python or the like? It seems that in every > yaml file, there is a comment at the top of the file like this.. > > > > --- !ruby/object:Puppet::Node > > > > Which doesn’t make may yaml parsers happy.. where am I going wrong? > > > > --Luke Baker > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > 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 unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e23870ec-93e1-4057-a616-977da955ec73%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Continue down the thread: http://www.mail-archive.com/puppet-users@googlegroups.com/msg11545.html and then this should help http://www.skorks.com/2010/04/serializing-and-deserializing-objects-with-ruby/ Puppet::Node is a data structure like Puppet::Transaction::Report and Puppet::Util::Log as described here: http://docs.puppetlabs.com/puppet/3/reference/format_report.html On Dec 12, 2013, at 7:04 PM, Stuart Cracraft <smcracraft@gmail.com> wrote:> Where did this go? > > On Friday, May 21, 2010 9:44:33 PM UTC-7, Luke Baker wrote: > Hey there, > > > I’ve playing with parsing some of the yaml data that puppet creates. Has anyone had luck doing this with python or the like? It seems that in every yaml file, there is a comment at the top of the file like this.. > > > --- !ruby/object:Puppet::Node > > > Which doesn’t make may yaml parsers happy.. where am I going wrong? > > > --Luke Baker > > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet...@googlegroups.com. > To unsubscribe from this group, send email to puppet-users...@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 unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e23870ec-93e1-4057-a616-977da955ec73%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out.“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/B5FC96FF-0FB6-4453-A21B-645DE1F65016%40comcast.net. For more options, visit https://groups.google.com/groups/opt_out.