Use send_email to email from cloud provisioning



I am trying to send an email notification at the end of my provisioning process. I can see by log messages that it is hitting the code and I don’t see any errors in the logs. I sent a test message from the appliance ui and it worked. I discovered I needed to turn on the notifier role on the appliance and I did that. I attempted to replicate in rails c from the appliance and this was the result:

$evm.execute(:send_email, ‘’, ‘’, ‘Hello’, ‘Hello’)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0

So it looks like it did something but I’m still not getting an error or the email in my inbox.


So I turns out this is working but there was a delay getting picked up off of the queue. Is there a way to see what messages are queued up?


You can see what automation tasks are in the queue from psql (or rails db):

select id,priority,method_name,state,queue_name,class_name,zone,role,msg_timeout from miq_queue where class_name like '%Automation%' or class_name like '%MiqAe%';

Anything with a state of ‘ready’ is waiting to be dequeued; anything with a state of ‘dequeue’ is currently being processed.

The automation engine is serviced by a generic worker, and each worker can only handle one job at a time, before looking to dequeue the next message. It may be that you’re already running two automate tasks, and have the default of 2 generic workers. It might be worth increasing the number of generic workers on your appliance(s) and seeing if this shortens the delay (this is done from Configuration -> select server -> Workers in the right pane)

Hope this helps,


This is incredibly helpful. I’m not a rails guy but is there a resource anywhere that has a collection of these type of commands in relation to manageiq/cloudforms? For example, when I ran this select I see several items in the queue. I ran select * from miq_queue where id = ‘100000001558244’; to get all the info for 1 of the id’s and then added created_on field to the original search to discover these were all created on 12-09 and are in ready state. I think in this case I would be interested in deleting these messages off of the queue. What is the best way to do that. etc. These messages are from an appliance where the automate role has been removed so I’m assuming that’s how these messages got stuck?


Hmm, the messages should be dequeued and processed by any server in the zone specified in the message’s ‘zone’ column running the Automation Engine role (assuming the server_guid column is empty, which it normally is for automate messages). I’d recommend having at least one appliance in every zone with the Automation Engine role enabled. Have you removed the zone?

Unfortunately there’s not a lot of documentation on this kind of thing, although there is some description of the messaging involved in distributed automation processing here:



I currently have automation engine role isolated to one appliance to make reviewing the logs easier as I’m learning and testing out changes to automate code. These messages are queued up in a zone that doesn’t have automate role enabled. Sounds like if I turn it on there it will clear the queue. I appreciate all your help!