Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2180760 - no way to test-fire a webhook when configuring it
Summary: no way to test-fire a webhook when configuring it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hooks and Webhooks
Version: 6.13.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.14.0
Assignee: Oleh Fedorenko
QA Contact: Lukáš Hellebrandt
Adam Lazik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-22 08:22 UTC by Evgeni Golov
Modified: 2024-03-08 04:25 UTC (History)
5 users (show)

Fixed In Version: rubygem-foreman_webhooks-3.2.0
Doc Type: Enhancement
Doc Text:
.You can now test-fire a webhook You can now test if a webhook functions correctly by clicking *Test webhook* from the list in the *Actions* column. After you enter a payload and click *Submit*, the webhook triggers.
Clone Of:
Environment:
Last Closed: 2023-11-08 14:19:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32363 0 Normal Ready For Testing Add a possibility to fire a webhook for testing purposes 2023-03-27 11:42:04 UTC
Red Hat Issue Tracker SAT-16762 0 None None None 2023-03-27 13:18:36 UTC
Red Hat Product Errata RHSA-2023:6818 0 None None None 2023-11-08 14:19:17 UTC

Description Evgeni Golov 2023-03-22 08:22:45 UTC
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:

Comment 1 Brad Buckingham 2023-03-23 14:25:05 UTC
Would you consider this an RFE or defect?

Comment 2 Evgeni Golov 2023-03-23 14:35:14 UTC
I would consider a "test this thing" core functionality that is missing. So a defect I guess

Comment 5 Bryan Kearney 2023-06-19 12:02:50 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32363 has been resolved.

Comment 6 Lukáš Hellebrandt 2023-07-13 13:29:46 UTC
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.

Comment 9 errata-xmlrpc 2023-11-08 14:19:02 UTC
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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818

Comment 10 Red Hat Bugzilla 2024-03-08 04:25:35 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


Note You need to log in before you can comment on or make changes to this bug.