Corey --

I mentioned this before in a previous post but I can't find that post.
>
> Anyways, I am using the puppet api rest interface and my python yaml
> parser doesn't like the output given.  Exactly what parser are you
> guys using to encode your objects into Yaml?  I don't know why my
> parser is choking you the yaml from puppet.
> I am using puppet enterprise 1.0 which is version puppet 2.6.4 I
> believe.  If I need to patch let me know how to patch with puppet
> enterprise.
>
> I am using the following yaml parser
>
> http://pyyaml.org/wiki/PyYAML
>
>
> This is the part where my yaml parse chokes on
>
>  File "/usr/lib64/python2.4/site-packages/yaml/constructor.py", line
> 419, in construct_undefined
>    node.start_mark)
> yaml.constructor.ConstructorError: could not determine a constructor
> for the tag '!ruby/object:Puppet::Node::Facts'
>  in "<string>", line 1, column 5:
>    --- !ruby/object:Puppet::Node::Facts
>        ^
>
> This is the yaml output from the test application I built which should
> correspond to line 1, column 5
> http://pastebin.com/0SgHerVM
>

That is valid (but inconvenient) yaml; the format specifically allows the
serialization of language/application specific objects.  But yeah, we wish
we'd not used that feature.

There are a few things you can do here: 1) most yaml parsers should have
hooks for you to define mapping to a "local" equivalent type; 2) a
sed/awk/python preprocessor could "generisize" the yaml by either replacing
the object reference with hashes (which are very similar) or by the
equivalent python construct (what does a python object look like
serialized?), 3) ... and I forgot what my third idea was...oh.  Some yaml
parsers have a (nonstandard) facility to morph unknown objects to something
"standard" (e.g. a dictionary).

Do either of these seem feasible?

-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the
maritime general prudential rule
------------------------------------------------------------

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

Reply via email to