Getting ManageIQ instance attributes without executing methods/states

I want to use the values from the ProvisionRequestQuotaVerification instance. The problem is that using $evm.instantiate will cause the code to run. This results in an exception or error.

Digging around I found


Which works as long as you know the full path including the domain, but then you can not rely on domain inheritance.

my_instance = $evm.instance_get("/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestQuotaVerification/default")

Here is my current workaround:

# Sending a fake message does not invoke the state because it is
# tied to the create message.
fake_message = "doesnotreallywork"
empty_instance = $evm.instantiate("/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestQuotaVerification/Default##{fake_message}")
# Unfortunately so are the attributes. However, now we know the real
# name of the resolved instance and can use that to get our attributes.
instance_name =
my_instance = $evm.instance_get(instance_name)
$evm.log(:info, "The instance contains: #{my_instance.inspect}

Leave a Comment

Your email address will not be published.