Description of problem: it's hard to test whether a webhook was correctly configured (in terms of endpoint, authentication, etc) without performing the actual action it is subscribed to Version-Release number of selected component (if applicable): 6.13.0 (but also all previous containing foreman_webhooks) How reproducible: 100% Steps to Reproduce: 1. create a new webhook 2. try to fire it, without performing the action it's subscribed to Actual results: not possible Expected results: I'd expect at least a way that the right type of request (POST) is sent to the right endpoint using the right authentication method. It might not contain the correct payload and thus the other side might still reject it, but at least I can see that the overall HTTP call worked. Additional info:
Would you consider this an RFE or defect?
I would consider a "test this thing" core functionality that is missing. So a defect I guess
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32363 has been resolved.
Verified with Sat 6.14.0 snap 6.0. 1) Create a webhook teplate with some data in Administer -> Webhook Teplates 2) Create a webhook using this template, assigned to some action (I used Content View Created) in Administer -> Webhooks. As a target, use some reachable machine and some usable port. 3) On the reachable machine, listen on the specified port: # echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -v -l 8042 4) In Administer -> Webhooks, in the webhook's row, in the Actions column, open the dropdown menu and click "Test webhook". 5) A popup will open, warning you that no actual data will be rendered from the template and this just tests communication layer. It allows you to enter data manually. I entered "data=testdata". 6) For test purposes, you need to disable Selinux on the Satellite: # setenforce 0 7) Click Submit RESULT ON THE LISTENING SERVER: $ echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -v -l 8042 Ncat: Version 7.93 ( https://nmap.org/ncat ) Ncat: Listening on :::8042 Ncat: Listening on 0.0.0.0:8042 Ncat: Connection from <IP>. Ncat: Connection from <IP>:58664. GET /?data=testdate HTTP/1.1 Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: */* User-Agent: Ruby Content-Type: application/json X-Request-Id: 6415e714-600d-499e-a667-994ab48433af X-Session-Id: 4b7da39c-5b85-4f8f-a2d3-6aa4a77968e8 Connection: close Host: <IP2>:8042 Content-Length: 14 data=testdata RESULT ON THE SATELLITE: A green pop-up notification stating: "Webhook Testhook test was successful" WHEN THE LISTENING SERVER IS NOT RUNNING, THEN ON SATELLITE: A red pop-up notification stating: "Error: Webhook test failed: Failed to open TCP connection to <IP>:8042 (Connection refused - connect(2) for "<IP>" port 8042)". Also, a traceback in production.log. Also, I verified that the webhook indeed gets executed on the specified action.