Hello group,
I played with the ReST API with puppet and used SnakeYAML to parse the
output. I run in some trouble to convert the YAML output in Java
objects.
I use maven to handle my dependencies and extended my small project
pom.xml with
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.9</version>
</dependency>
I've added also the repository as suggested on the project page like
this:
<repository>
<id>Sonatype-public</id>
<name>SnakeYAML repository</name>
<url>
http://oss.sonatype.org/content/groups/public/</url>
</repository>
I started first with a simple structure with a list of strings to
figure out if I can use SnakeYAML in my project. Hint: it is
implemented via ReST so service is my web resource. The code snippet
and the output is here:
http://paste2.org/p/1889527
The next was to get a more complex YAML structure from puppet - a
puppet node:
The link below shows the YAML structure as plain text:
http://paste2.org/p/1889520
If I want to parse this into an object I retrieve the following
exception:
Exception in thread "main" Can't construct a java object for !ruby/
object:Puppet::Node; exception=Invalid tag: !ruby/object:Puppet::Node
in "<string>", line 1, column 5:
--- !ruby/object:Puppet::Node
^
With some google search I found an entry to strip off "!ruby/" from
the object. I gave it another try with another exception
Exception in thread "main" mapping values are not allowed here
in "<string>", line 2, column 10:
classes: []
For me it is just enough to have the puppet node as a plain java bean
object. It would be nice if someone can shed some light on my first
steps in YAML and Java.
Thank you in advance
Ronny