Created
August 25, 2017 20:08
-
-
Save trisharia/bee991415d90e0b3dfd767e4862a8177 to your computer and use it in GitHub Desktop.
Is the vCenter VM a template?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VMware vRealize Orchestrator action sample | |
// | |
// Determine whether the given vCenter VM is a template | |
// | |
// For vRO 7.0+/vCenter 6.0+ | |
// | |
// Action Inputs: | |
// vm - VC:VirtualMachine - vCenter VM | |
// | |
// Return type: boolean - true if the VM is a template | |
if (vm.config) { | |
if (vm.config.template) { | |
return true; | |
} | |
} else if (vm.summary) { | |
System.warn("Config info of VM " + vm.name + " is inaccessible. Trying config summary info ..."); | |
if (vm.summary.config.template) { | |
return true; | |
} | |
} else if (!vm.config && !vm.summary) { | |
throw "Cannot deteremine if VM " + vm.name + " is a template because its config info and config summary info are both inaccessible"; | |
} | |
return false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment