Skip to content

Backend knowledge tidbits

Martin Hradil edited this page Feb 18, 2020 · 2 revisions

Validate EMS Credentials:

ExtManagementSystem.validate_credentials_task(???, User.current_user.userid, MiqServer.my_zone)

(??? is whatever ExtManagementSystem.raw_connect? takes.)

Validate Host Credentials:

Host#verify_credentials_task(User.current_user.userid, ???)

(??? is whatever Host#verify_credentials takes.)

Queuing a task:

MiqTask.generic_action_with_callback({:userid => User.current_user.userid, :action=> 'Just a name'}, {:args=>[], :class_name=> 'SomeKlass', :instance_id => SomeKlass.first.id, :method_name => 'magic', :queue_name => 'generic', :role => 'ems_operations', :zone => MiqServer.my_zone})

Running the queue:

simulate_queue_worker - but any task is executed immediately, regardless of timing

(or see manageiq/Procfile.example to run actual specific workers)

MiqTask data:

on error, status is Error, message is the exception message, state is Finished, and the exception class does NOT get saved anywhere

on success, TODO .. results are the result data.

Clone this wiki locally