I have been working on this for a while now and can't figure it out. Here's the situation:
- I have 1 source server that gets new data every weekend
- I destroy all linked clones before the data refresh and delete the current snapshot
- The refresh happens and I create a new snapshot
- I have to go into vrealize designer and set the new snapshot in the blueprint <-- this is the step I can't seem to automate
- create new linked clones ready for monday
I have everything else automated in workflows for Orchestrator but can't seem to figure out how to update what snapshot a blueprint is using when the component is a vSphere Linked Clone.
My latest attempt was setting "snapshot_name", "source_machine_external_snapshot", and "source_machine_vmsnapshot" on the blueprint using the following: (the commented out lines are from various attempts)
//System.log(blueprint.getComponents());
var components = blueprint.getComponents();
for each(var componentkey in components.keys){
var component = components.get(componentkey);
var data = component.getData();
for each(var item in data.keys){
System.log("item:" + item);
if(item.indexOf("snapshot") > -1){
var facets = data.get(item).getFacets();
if(item == "snapshot_name"){
System.log(item + ": " + facets.get("fixedValue"));
// var myval = vCACCAFEConstantValue.fromString("VM Snapshot 8%252f28%252f2018, 4:27:43 PM");
var myval = vCACCAFEConstantValue.fromString("second snapshot");
//facets.put("fixedValue", myval);
//System.log(item + ": " + facets.get("fixedValue"));
}
if(item == "source_machine_external_snapshot"){
System.log(item + ": " + facets.get("fixedValue"));
// var myval = vCACCAFEConstantValue.fromInt(3);
var myval = vCACCAFEConstantValue.fromInt(3);
//facets.put("fixedValue", myval);
//System.log(item + ": " + facets.get("fixedValue"));
}
if(item == "source_machine_vmsnapshot"){
System.log(item + ": " + data.get(item).getFacets().get("fixedValue"));
var i1 = data.get(item);
var f1 = i1.getFacets();
var f2 = f1.get("fixedValue");
// var entity = new vCACCAFEEntityReference(null, "Infrastructure.Compute.Machine.Snapshot", "58", null);
var entity = new vCACCAFEEntityReference(null, "Infrastructure.Compute.Machine.Snapshot", "58", null);
var myval = new vCACCAFEConstantValue(entity);
f1.put("fixedValue", myval);
i1.setFacets(f1);
//data.put(item, i1);
//System.log(item + ": " + data.get(item).getFacets().get("fixedValue"));
}
// for each(var facet in facets.keys){
// System.log(item + ": facet:" + facet);
// System.log("facet detail:" + facets.get(facet).getValue().value);
// }
var m = data.get(item);
m.setFacets(facets);
//data.put(item, m);
}
/* var facets = item.getFacets();
for each(var facet in facets.keys){
System.log(facet);
}*/
}
//component.setData(data);
//components.put(componentkey, component);
}
//blueprint.setComponents(components);
Any ideas?