Project

General

Profile

Actions

Bug #35777

open

@object is not available in build_entered.event.foreman

Added by Manuel Laug about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

I want to run a webhook on host destroy and build_entered events to update a third-party system and remove the old host entry there (will be generated again once the host is (re)deployed).
When using the default payloads, I do get the following error as `@object` itself is `nil`.

undefined method '#id' for NilClass::Jail (NilClass)

For debugging purposes, I've created a new webhook template, attached a webhook to build_entered event and the payload and send the request to a `nc -kl 127.0.0.1 8888` Session.

<%#
name: Test Payload
description: Useful for testing
snippet: false
model: WebhookTemplate
-%>
<%=
payload({
  object: @object
})
-%>

This results in the following HTTP body:

{"object":null,"event_name":"build_entered.event.foreman","webhook_id":2,"context":{"remote_ip":"172.26.160.98","request":"df61a684-23e5-4e02-ad13-cffb6e2fed3e","session":"703ecd63-9ac3-416f-88e2-bd85aed4b46c","user_login":"admin","user_admin":true}}

Using the same template and config but the host destroy event, the payload looks fine and contains the host object being deleted.

No data to display

Actions

Also available in: Atom PDF