I am wanting to use Sinatra to create a REST web service that will
execute Powershell (PowerCLI for VMware) on the back end. The Rest API
will accept JSON which will then be used to make connections to
specified vsphere servers and do things like clone VMs, add memory, CPU,
disk, NIC.
The PowerCLI code is already written, I just need the web service to
call the code and pass the paramters (JSON). I am not sure if it’s best
to put the PowerCLI code in the web service and call it as exec
(interpolation hell) or to have Sinatra just call the powershell scripts
and pass the JSON that way.
Anything else I’m missing? (Yes I’m aware of rbvmomi)
May be you can just shell out? Remember that if your Powershell script
will fall apart and you use something that directly use that code, your
web service will fall apart. By shelling out you add a layer of
isolation.