Hi guys!
I have several problems with automation. I’m trying to create service catalog according to the documentation. But I can’t change any provisioning parameters (memory or VM name). Steps I’ve made:
- I’ve create service dialog with the parameter
- I’ve create the method processing this parameter
- I use method in state machine for service provisioning.
- I’ve create Catalog Bandle with template.
I need to change provisioned vm_name in this case in Factory / Service / CatalogProviderSelect method that attached to clone_to_service State Machine.
My method are:
#
# Automate Method
#
$evm.log("info", "Automate Method Started")
#
# Method Code Goes here
#
$evm.log("info", "===========================================")
$evm.log("info", "Listing ROOT Attributes:")
$evm.root.attributes.sort.each { |k, v| $evm.log("info", "\t#{k}: #{v}")}
$evm.log("info", "===========================================")
stp_task = $evm.root["service_template_provision_task"]
$evm.log("info", "===========================================")
$evm.log("info", "Listing task Attributes:")
stp_task.attributes.sort.each { |k, v| $evm.log("info", "\t#{k}: #{v}")}
$evm.log("info", "===========================================")
#
id = stp_task.miq_request_id.to_s[-3,3]
dialog_Department = $evm.root['dialog_Department']
$evm.log("info","User selected Dialog option = [#{dialog_Department}]")
stp_miq_request_task = stp_task.miq_request_task
$evm.log("info","(parent) miq_request_task: = [#{stp_miq_request_task}]")
stp_miq_request_tasks = stp_task.miq_request_tasks
$evm.log("info","(children) miq_request_tasks count: = [#{stp_miq_request_tasks.count}]")
stp_miq_request_tasks.each do |t|
# service = t.source
# service_resource = t.service_resource
vm_name = nil
case dialog_Department
when "ITD"
vm_name = "SRV-ITD-" + "#{id}"
$evm.log("info","Setting SAG Depatment")
when "RND"
vm_name = "SRV-RND-" + "#{id}"
$evm.log("info","Setting RND Department")
else
$evm.log("info","Unknown Dialog type - setting Dialog options here")
end
$evm.log("info"," Setting dialog for: #{t.description}")
$evm.log("info","Get Current VMNAME: #{t.get_dialog_option('vm_name')}") unless vm_name.nil?
$evm.log("info","Get Current Memory: #{t.get_dialog_option('memory')}") unless vm_name.nil?
t.set_dialog_option('vm_name',vm_name) unless vm_name.nil?
$evm.log("info","Set vm_name for provisioning: [#{vm_name}]")
end
#
#
#
$evm.log("info", "Automate Method Ended")
exit MIQ_OK
I can not perform set_dialog_option method as described in this chapter, because no provisioning dialog options are available (memory, vm_name) at the time of execution of my method…
https://access.redhat.com/documentation/en-US/CloudForms/3.0/html/Management_Engine_5.2_Lifecycle_and_Automation_Guide/sect-Methods.html
There is a automation.log: https://raw.githubusercontent.com/ITD27M01/scripts/master/backup/automation.log