Bug #36910
closedUsing ERB with "Test Webhook" functionality raises an exception
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
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
Updated by Oleh Fedorenko about 1 year ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_webhooks|7ed08ede70d2b07ee90d19e5dd01126ae5b182d6.
Updated by Adam Ruzicka about 1 year ago
- Fixed in Releases foreman_webhooks-3.2.2 added