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
Created redmine issue https://projects.theforeman.org/issues/34110 from this bug
Upstream bug assigned to ofedoren
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34110 has been resolved.
Tested on Sat 7.0 Snap 8 using the reproducer from the original report. After clicking Build button 2022-02-09T10:02:26 [I|app|b43f1e6d] Performing 'WHBuildEnter' webhook request for event 'build_entered.event.foreman' 2022-02-09T10:02:26 [W|app|b43f1e6d] Could not parse HTTP headers JSON, ignoring: no implicit conversion of nil into String 2022-02-09T10:02:26 [I|app|b43f1e6d] Started GET "/buildentered" for 127.0.0.1 at 2022-02-09 10:02:26 -0500 2022-02-09T10:02:26 [F|app|b43f1e6d] b43f1e6d | ActionController::RoutingError (No route matches [GET] "/buildentered"): b43f1e6d | b43f1e6d | lib/foreman/middleware/logging_context_request.rb:11:in `call' b43f1e6d | katello (4.3.0.1) lib/katello/prevent_json_parsing.rb:12:in `call' 2022-02-09T10:02:26 [E|app|b43f1e6d] GET response was 404 After clicking Cancel build button 022-02-09T10:03:45 [I|app|16c477f7] Performing ForemanWebhooks::DeliverWebhookJob (Job ID: 181a1a1e-5106-4ff0-a20f-c1127e6b9799) from Dynflow(default) enqueued at 2022-02-09T15:03:44Z with arguments: {:event_name=>"build_exited.event.foreman", :payload=>"", :headers=>nil, :url=>"https://localhost/buildexited", :webhook_id=>2} 2022-02-09T10:03:45 [I|app|16c477f7] Performing 'WHBuildExited' webhook request for event 'build_exited.event.foreman' 2022-02-09T10:03:45 [W|app|16c477f7] Could not parse HTTP headers JSON, ignoring: no implicit conversion of nil into String 2022-02-09T10:03:45 [I|app|16c477f7] Started GET "/buildexited" for 127.0.0.1 at 2022-02-09 10:03:45 -0500 2022-02-09T10:03:45 [F|app|16c477f7] 16c477f7 | ActionController::RoutingError (No route matches [GET] "/buildexited"): 16c477f7 | 16c477f7 | lib/foreman/middleware/logging_context_request.rb:11:in `call' 16c477f7 | katello (4.3.0.1) lib/katello/prevent_json_parsing.rb:12:in `call' 2022-02-09T10:03:45 [E|app|16c477f7] GET response was 404 Both hooks were delivered successfully (again, ignore routing errors, those are webhooks pointing to https://localhost/buildentered and https://localhost/buildexited).
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5498