Actions
Bug #35825
openPayload crashes if object returns nil
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Description
Using a template like:
<%=
payload({
id: @object.id,
name: @object.name,
organization: @object.organization.name,
ip: [ @object.ip, @object.ip6 ],
description: @object.comment,
hostgroup: @object.hostgroup
})
-%>
The webhook/payload-function crashes if the host targeted has no hostgroup with a message that it cannot 'render' for nil:NilClass.
You can workaround that by casting that into a string with:
hostgroup: @object.hostgroup.to_s
But in that case if the hostgroup is not set it will just return an empty string and something like "null" would be better.
Version used is Foreman 3.1 with Webhooks-Plugin 3.0
No data to display
Actions