ruby-on-railsrails-consolemanageiq

How to setup basic ManageIQ automate environment in Rails console?


I used to run some operations in ManageIQ through automate simulation, which is available from UI. I'd like to find a way to reproduce these operations from rails console.

For example operations for Instance management - migrate, evacuate or relocate instance. How do I make it?


Solution

  • There's the common way to do this:

    Set up a basic $evm context in a Rails console

    # rails c

    # $evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)

    For example you can find any VM in vmdb and define it into a variable:

    # vm = $evm.vmdb('vm').find('some_id')

    Similar with other objects, e.g.

    flavor = $evm.vmdb('flavor').find(flavor_id)