How to debug automate


#1

I’m a beginner of Ruby and RoR,and i would appreciate your help greatlly.
I am trying to understand the process of automate, so i want to know how to debug automate through rubymine or some other IDE
thanks very much


#2

@gmccullough can you review this question from @theseaofstars and forward to SME if necessary.


#3

Hi @theseaofstars,

To debug you can use:

  1. Use Automate -> Simulation to run your automate model (I like to add the dump_root logic from the /ManageIQ/System/Request/InspectMe method to see what is passed to the method.)
  2. Load the $evm object outside of automate (console or rails runner script) and make calls against it.

Example:

$evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
vm = $evm.vmdb(:vm).first # Returns VM service_model instance
vm = $evm.vmdb(:vm).find_by(:id => nnn) # Returns VM service_model instance

I also recommend checking out this guide: https://www.gitbook.com/book/pemcg/introduction-to-cloudforms-automation/details

@mkanoor @pemcg @ramrexx May have other helpful suggestions for debugging.


#4

Thanks a lot @gmccullough :slight_smile:
I am following the automate.log file to see the process that provisioning a vm through a service.
I find the process was begin with instantiating of a instance, and then the call of other instance.
For example:
[----] I, [2016-03-29T22:46:38.662908 #3016:991998] INFO – : Instantiating [/System/Process/Event?EventStream%3A%3Aevent_stream=1000000032227&MiqProvisionRequest%3A%3Amiq_provision_request=1000000000044&MiqRequest%3A%3Amiq_request=1000000000044&MiqServer%3A%3Amiq_server=1000000000001&User%3A%3Auser=1000000000001&event_stream_id=1000000032227&event_type=request_approved&object_name=Event&vmdb_object_type=miq_provision_request]
[----] I, [2016-03-29T22:46:38.861265 #3016:991998] INFO – : Following Relationship [miqaedb:/System/Event/RequestEvent/Request/request_approved#create]
And i also know that the $evm.instantiate can make a instantiating.
But where can i find the script or something that use the $evm.instantiate to make the instantiating in the process of provisioning a vm through a service.
Thanks a lot