Disable auto approval on Lifecycle -> Provision VM using selected Template

Hi everyone,
Is there a way for me to disable auto approval on the Lifecycle and Provision VM using selected Template menu?

There is an approval step in /Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestApproval/validate_request

Thanks for the comment buc.
What should i change in the script?
I really dont know nothing about ruby.

If you look at the Instance (/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestApproval/Default) the state machine has 3 methods:

  • approve_request this one just approves the request and manageiq continues executing
  • pending_reuqest this method sets the request to the pending state, which fires a event within manageiq (/System/Policy/request_pending) that will eventually send an email to somebody informing them that there is a request they need to approve
  • validate_request this is where the action happens.

If you take a look at the instance, notice that validate_request is called first. It now depends on the exit-code of that method. If validate_request exists normally, the next method to execute would be approve_request and the request is auto-approved, If validate_requests exits with an error, manageiq executes the on_error method pending_request and the request is set to pending

Now if you look at validate request it does exactly that.

if approval_req == true
  msg =  "Request was not auto-approved for the following reasons: "
  $evm.log("info", "Inspecting Messge:<#{msg}>")

  $evm.root['ae_result'] = 'error'
  $evm.object['reason'] = msg

You just need to rewrite that method to check which template the user selected in the dialog (prov.source.name) and either set approval_req to true or false

If you haven’t used Automate before, I recommend this book: https://pemcg.gitbooks.io/mastering-automation-in-cloudforms-4-2-and-manage/content/introduction/chapter.html