Updating vCAC 6.x Machine Properties At Approval Time

Ever wish you could set up an approval process that would allow people to update VM properties other than just the 4 (vCPU, memory, number of machines ,and lease length)? Now you can! All you have to do is call the vCO workflow below during the BuildingMachine state change action in a specific syntax.

What it does:
A end user would request a service that has one approval on it, as they normally would. When the approval is sent to the approver, the approver enters whatever they want into the justification field as well as changes any other fields they want. The last part of the justification text entered would be in a syntax shown below which will allow vCO to pick the fields out of the justification and then update them on the vCAC VM.

Assumptions:
Requirement for this plugin is that you are using an external vCAC Postgres or vPostgres database. This limitation is only set because at the time that I'm writing this, I don't know the Postgres database password for the instance on the vCAC appliance.

Current Limitations:
You can only use this for approvals that have one approver. In the future, I might update this to include multiple approvers/approval levels. This code was tested against a future release of vCAC, but should still work with 6.0.1.

1. Download the vCAC 6.0.1 vCO plugin from HERE
2. install, and set up the vCloud Automation Center vCO plugin per the instructions found HERE
3. Download the package for updating the Virtual Machine Properties from HERE
4. Import the package into vCO by opening the vCO client and on the vCO Home tab, click the import package button, then choose the info.vcacteam.updateatapproval.package
5. Create a new database connection by running the SQL/Configuration/Add a database workflow. Some sample input properties would be:
     Name: vCAC Postgres
     Database Type: PostgreSQL
     Connection URL: jdbc:postgresql://<External_postgres_URL>:5432/<External_postgres_database_name>
     Session Mode: Shared Session
     User name: vcac
     Password: <you_should_know_this>
6. You'll have to go into the "Add/Update VM Properties from Approval" and edit the workflow in order to update the "database" field to be your vCAC Postgres database object you created
7. Run the vCloud Automation Center/Infrastructure Administration/Extensibility/Assign a state change workflow to a blueprint and its virtual machines. Sample inputs would be:
     vCAC worflow stub to enable: BuildingMachine
     vCAC Host: (the value you set when you installed the vCAC plugin)
     Blueprints: (choose the blueprints that you want to apply this to)
     Apply machine operation changes  to existing machines: No
     End user workflow to run: Add/Update VM Properties from Approval
     Add vCO workflow inputs as blueprint properties: No
     Add last vCO Workflow run input values as blueprint property values: No
8. Make sure that you have an approval policy set up that will run. You can find more information how to set up the approvals by watching this video, HERE
9. When completing the approval, use the following syntax in the Justification field in order to specify the properties that you want to update or add (note that anything desired text can be added BEFORE the "Properties:" text):
     Properties:
     <Property_Name1>=<Value>,<Property_Name2>=<Value>

Example:
     Properties:
     VirtualMachine.Network0.Address=192.168.110.100,VirtualMachine.Network0.Gateway=192.168.110.2


Thanks to Phil Barlow in the APJ for the idea to use the justification field!