Created
December 11, 2016 18:06
-
-
Save Cameronwyatt/16a92c9d3ecbdb92a46697403dc6f866 to your computer and use it in GitHub Desktop.
CloudForms Automate - check DNS for VM's FQDN name before giving it out to VM being provisioned.
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
vm_fqdn = "#{vm_name}#{hostname_suffix}" | |
begin | |
Resolv::DNS.new.getaddress(vm_fqdn) | |
rescue Resolv::ResolvError | |
#If we get a ResolvError, that means that the VM FQDN cannot be found | |
#That indicates that the VM name that we have calculated does not exist in DNS already | |
#return VM name here | |
rescue => err | |
$evm.log(:warn, "Error querying DNS for VM name:|#{err}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment