Trying to debug automate method by logging contents of $evm.root

I hope this makes sense(I’m still learning Ruby).

I have this at the beginning of my “vmware_best_fit_with_tags” automate method:

prov = $evm.root[‘miq_provision_request’] || $evm.root[‘miq_provision’] || $evm.root[‘miq_provision_request_template’]

$evm.log(‘info’, “TROUBLESHOOTING Provision Object: #{prov.inspect}”)

It dumps out a whole bunch of stuff but the information I really need appears to be wrapped up in a nested array which appears to be an instance variable. Part of my “#{prov.inspect}” output looks like this:

@associations=[“destination”, “eligible_clusters”, “eligible_customization_templates”, “eligible_folders”, “eligible_hosts”, “eligible_iso_images”, “eligible_pxe_images”, “eligible_pxe_servers”, “eligible_resource_pools”, “eligible_storage_profiles”, “eligible_storages”, “eligible_windows_images”, “miq_provision_request”, “miq_request”, “miq_request_task”, “miq_request_tasks”, “source”, “tenant”, “vm”, “vm_template”]

vmware_best_fit_with_tags is looking for things like eligible_hosts and eligible_storages but isn’t finding them - I haven’t been able to even print these values out to the log.

Can somebody tell me how I might get the values of those “@associations” elements?


associations should be accessible from the main object:

$evm.log(:info, “Hosts: #{prov.eligible_hosts}”)

That was one of the first things I tried that but it comes up empty:

$evm.log(:info, “TROUBLESHOOTING HOSTS: #{prov.eligible_hosts}”)

[----] I, [2019-07-09T14:53:12.970542 #19298:93826c] INFO – : Q-task_id([r1000000002110_miq_provision_1000000001922]) TROUBLESHOOTING HOSTS:

If the values are not being set yet then it seems there’s a bigger problem, as these are required for VM placement.