Project

General

Profile

Actions

Bug #36910

closed

Using ERB with "Test Webhook" functionality raises an exception

Added by Oleh Fedorenko about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description of problem:
When I use ERB in the webhook's Target URL, the testing the webhook throws an exception. E.g. using "http://machine.example.com/inventory/<%= @object.id %>", a test throws:
"""
Error
Webhook test failed: undefined method '#id' for NilClass::Jail (NilClass)
"""

When testing a webhook, the following is shown to the user:
"""
You are about to test test webhook. Please, note that this will not contain actual information or render the attached template. You can specify below a custom payload to test the webhook with.
"""

It states that the request's content won't contain the actual info. But this is in target URL. It's understandable why it doesn't work because while testing, there is actually no object to populate that variable with. But it may be unexpected by the user.

Version-Release number of selected component (if applicable):
Sat 6.14.0, previous versions didn't have Test Webhook functionality

How reproducible:
Deterministic

Steps to Reproduce:
1. Administer -> Webhooks -> Create
2. Fill in, use a variable in the target URL, e.g. "http://machine.example.com/inventory/<%= @object.id %>"
3. Submit, Test Webhook

Actual results:
The variable can't be used

Expected results:
The variable can be used or the failure is more expectable by the user, it shouldn't look like a bug

Actions #1

Updated by Oleh Fedorenko about 1 year ago

  • Description updated (diff)
Actions #2

Updated by Oleh Fedorenko about 1 year ago

  • Red Hat JIRA set to SAT-21244
Actions #3

Updated by The Foreman Bot about 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_webhooks/pull/68 added
Actions #4

Updated by Oleh Fedorenko about 1 year ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by Adam Ruzicka about 1 year ago

  • Fixed in Releases foreman_webhooks-3.2.2 added
Actions

Also available in: Atom PDF