Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

vCO and JSON

$
0
0

A plan of mine when I started building a vCO environment was to integrate it with Puppet, so when we built VMs we could define configuration information that Puppet could use to build the system.

 

This was after months of searching around investigating other products like The Foreman and such.

 

How I do this is by reading and writing JSON to a file which is read by Hiera and fed into Puppet. Eventually we'll start using a key-value store like CouchDB, this is early days in our implementation.

 

However a huge problem I'm facing is the how vCO runs JavaScript, parameters passed into or out of a workflow are converted into Java objects and then back into JavaScript. From what I gather you're meant to use Properties as a object type that acts like JavaScript Objects, but it won't convert into JSON.

 

When trying to pass JavaScript Objects between Workflows using an Any type the same issue occurs, the object is converted to a Java type then back into JavaScript which clobbers it.

 

Take two example workflows:

 

Test javascript which creates two objects, one a flat JSON string converted to an Object and one an Object created use new Object(). It deserialises both objects and logs the output:

JSON-vCO-1.JPG

 

Test workflow which calls Test javascript workflow and attempts to deserialise both objects:

 

JSON-vCO-2.JPG

 

The output log is:

 

[2014-10-16 22:01:07.657] [I] {"a":{"b":"c"}}

[2014-10-16 22:01:07.658] [I] {"a":{"b":"c"}}

[2014-10-16 22:01:07.711] [I] {}

[2014-10-16 22:01:07.712] [I] {}

 

So both objects successfully deserialise in the initial workflow but once they're passed to the second workflow they can't be deserialised


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>