I am currently trying build a catalogue item that provisions a machine via openstack.
I can provision a machine using the cloud/instances/Lifecycle route. And I am trying to build a service item from a template provisioning request.
It seems to me that as I am adjusting the specification of the machine based on the contents of the dialog then my customizations need to be made before the machine is automatically approved ( as the customizations can change the vm that is being requested )
I have created a new state machine with an openstack customization state. And I have started work on a piece of ruby that will process the request before it is approved.
I need to adjust the tenant from the template request for example and I need to instantiate the cloud provider. The following code looks reasonable:
request = $evm.root['miq_request'] source = request.source service_resource = source.service_resources.first resource = service_resource.resource openstack = ExtManagementSystem.find(resource.options[:src_ems_id])
However in the automation method I get:
ERROR -- : <AutomationEngine> Method STDERR: <code: openstack = ExtManagementSystem.find(resource.options[:src_ems_id])>:59:in `<main>': uninitialized constant ExtManagementSystem (NameError)
Am I correct in editing the provisioning request before the approval and if so what would be the correct way of getting at the object that represents the openstack system ?
Looking at some Redhat docs it implies that a method is to create a new provisioning request without using a template request however it leaves all of the emsCustomAttributes blank with no examples so that is less than useful.
Peter’s book is more useful, is this the recommended route. I think looking at things there is enough information in Peter’s book to get me going however it would be good to know I was heading in the right direction.
Could people clarify the correct approach for creating a service catalogue item for provisioning a machine.