Why I can't get miq_provision options from a provision dialog

automate
providers

#1

So I’m stuck here trying to get dialog options. I have tried many options for example:

prov = $evm.root['miq_provision_request'] || \
        $evm.root['miq_provision'] || \
        $evm.root['miq_provision_request_template']

vm_name = prov.get_option(:dialog_vmvariable).to_s.strip 

or

vm_name = prov.get_option(:dialog_vmvariable).to_s.strip
or
vm_name = prov.get_option(:dialog_vmvariable)
vm_name = prov.get_option(:vmvariable)

it’s just that I can’t get any dialog inputs, do I need to copy something ( method, class…) into my domain so these information can be available?


#2

The dialogs are located differently depending on whether you’re looking at the request or task options hash. For an miq_provision_request they are generally in $evm.root['miq_provision_request'].options[:dialog], for a service template provision task they would be in $evm.root['service_template_provision_task'].options[:dialog], but in an miq_provision (task) object they would be broken out as individual dialog keys, such as $evm.root['miq_provision'].options[:dialog_ip_addr]

Have you tried examining the entire prov object to see what’s there using something like object_walker?

pemcg


#3

Thank you for your reply, I have made a service catalog where I provision vms from a template, does $evm.root['service_template_provision_task'].options[:dialog] would work in my case, and if yes, how do I get objects to be used in a method?
Let’s say that in the service dialog I have option_0_vm_name how do I work with the input of this object to be used?

For object_walker, I haven’t used it, I will follow the instructions listed in your book and I will keep you updated.

Thank you again.