Bug #34110
closedwebhook event "build_exited" never gets triggered
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2029375
Description of problem:
While using FormanWebhooks instead of Foreman Hooks which are deprecated. Clicking the "Build" button on a host in the WebUI of Satellite 6.10.1 generates a "build_entered" event like expected.
~~~~~
Extract from /var/log/foreman/production.log:
2021-12-06T16:38:22 [I|app|4b86abd6] ForemanWebhooks::EventSubscriber: build_entered.event.foreman event received
~~~~~
However, a "build_exited" event never gets created. No matter if "Cancel build" in the WebUI is clicked or the build successfully finished and the Provisioning Template "built" is called.
None of this creates a "build_exited" event but only a "host_updated" event:
~~~~~
2021-11-29T17:02:36 [I|app|8fd48b72] ForemanWebhooks::EventSubscriber: host_updated.event.foreman event received
~~~~~
Version-Release number of selected component (if applicable):
6.10.1
How reproducible:
Frequently.
Steps to Reproduce:
1. Install Webhook Plugin like described here:
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html/administering_red_hat_satellite/using-foreman-webhooks_admin#installing-webhooks-plugin_admin
2. Create a Webhook that is subscribed to the event "Build Entered".
3. Create a Webhook that is subscribed to the event "Build Exited".
4. In Satellite-GUI navigate to Hosts --> All Hosts and click on one of the already existing hosts in Satellite.
5. Click the "Build" button and confirm the warning by clicking "Build" again.
6. Notice in /var/log/foreman/production.log that the build_entered event got triggered and the Webhook "Test" was executed:
2021-12-06T11:29:55 [I|app|cdce2ef3] ForemanWebhooks::EventSubscriber: build_entered.event.foreman event received
2021-12-06T11:29:55 [I|app|cdce2ef3] Enqueued ForemanWebhooks::DeliverWebhookJob (Job ID: 1z02xxxx-2XXf-40ab-a53e-ccff1123456J1) to Dynflow(default) with arguments: {:event_name=>"build_entered.event.foreman", :payload=>"", :headers=>nil, :url=>"https://satellite.example.com:444/sat6ansible/hello", :webhook_id=>2}
2021-12-06T11:29:55 [I|app|cdce2ef3] ForemanWebhooks::EventSubscriber: host_updated.event.foreman event received
2021-12-06T11:29:55 [I|app|cdce2ef3] Performing ForemanWebhooks::DeliverWebhookJob (Job ID: 1z02xxxx-2XXf-40ab-a53e-ccff1123456J1) from Dynflow(default) enqueued at 2021-12-06T10:29:55Z with arguments: {:event_name=>"build_entered.event.foreman", :payload=>"", :headers=>nil, :url=>"https://satellite.example.com:444/sat6ansible/hello", :webhook_id=>2}
2021-12-06T11:29:55 [I|app|cdce2ef3] Performing 'Test' webhook request for event 'build_entered.event.foreman'
2021-12-06T11:29:55 [I|app|cdce2ef3] Performed ForemanWebhooks::DeliverWebhookJob (Job ID: 1z02xxxx-2XXf-40ab-a53e-ccff1123456J1) from Dynflow(default) in 29.9ms
~~~~~~~~~~~~~~~~
7. Click the "Cancel Build" button
8. Notice in /var/log/foreman/production.log that the build_exited event is NOT triggered and the Webhook "Call Ansible Provisioning" is NOT executed. Only a "Host Updated" event is triggered:
2021-12-06T11:32:03 [I|app|c68fc8b8] ForemanWebhooks::EventSubscriber: host_updated.event.foreman event received
The same happens if you perform the Rebuild and the host gets provisioned successfully.
According to this table, the Webhook should be triggered in both cases but it is not:
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html/administering_red_hat_satellite/using-foreman-webhooks_admin#webhooks-available-events_admin
Actual results:
- webhook event "build_exited" never gets triggered
Expected results:
webhook event "build_exited" should get triggered