Miq_provision - trying to find the AWS vpc-id attribute

automate

#1

I have written a method attached to a button that will inventory AWS Route 53 DNS entries from within CloudForms, in the context of an existing VM. I am trying to update the code to run during provisioning of a new VM.
Unfortunately I can’t seem to find the right attribute to query the AWS VPC-ID for the VPC that the VM is being provisioned into. I have run InspectMe and ObjectWalker, but still haven’t been able to identify the right attribute. I have a couple of cloud_network attributes that relate, but one is the tag for “name” of the VPC and the other is called vpc-id, but isn’t the AWS vpc-id (I assume it’s a vmdb attribute that represents the vpc). Everything I have found so far points to a requirement to have the vpc-id.


[Solved] AWS AMI and Provider selection
#2

The ems_ref attribute is often used on objects to store the provider’s reference. I see an ems_ref attribute on both cloud_network and cloud_subnet on an AWS VM, try these to see if they look likely.

Hope this helps,
pemcg


#3

Looks like that’s the ticket! Thanks. Coulda sworn I tried that, but must have had a typo. I am curious why the code below doesn’t return ems_ref, though.

This returns 2 records --> 100000000000007 and (10.0.0.0/18), but does not return ems_ref

$evm.root[‘miq_provision’].options[:cloud_network].each do |rr|
log(:info, “Cloud_Network Attributes is #{rr}”)
end