Project

General

Profile

Actions

Bug #20062

open

Host parameter not rendered in user_data template

Added by Anthony Chevalet over 7 years ago. Updated over 5 years ago.

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

Description

I'm running Foreman 1.14.3 and have an issue with host parameters not available in user_data template.

In the template I have:

<%= @host.params['myparam'] %>

On the host creation page, in the parameter tab, I add a host param 'myparam' with value 'test'.
Once the host is created, the 'Preview' template correctly shows the param value.

But the generated template on the target machine (in /var/lib/cloud..) does not contain the param value (it is empty).

If I set the parameter on hostgroup or subnet then it works as expected.
The problem is only with params at host level.


Related issues 4 (4 open0 closed)

Related to Foreman - Bug #19465: User data template rendering does not render host parametersNewActions
Related to Foreman - Bug #23104: Host parameters not available in foreman_hooks Need more informationActions
Related to Foreman - Bug #21618: hostgroup parameter does not show up in the PXE templateNew11/09/2017Actions
Related to Foreman - Bug #21552: Host parameters added/updated via API do not make it to userscript on provisioning to EC2New11/01/2017Actions
Actions #1

Updated by Tyler Gregory over 7 years ago

This is probably related to #19465

Actions #2

Updated by Anthony Chevalet over 7 years ago

Yes it seems so, in my case the preview does render the parameter

Actions #3

Updated by Marek Hulán over 7 years ago

  • Status changed from New to Need more information

Are you using organizations or locations? Could you update to 1.15 and retest?

Actions #4

Updated by Marek Hulán over 7 years ago

  • Related to Bug #19465: User data template rendering does not render host parameters added
Actions #5

Updated by Anonymous over 7 years ago

Yes I'm using organizations and locations.
I will upgrade to 1.15 and let you know.

Actions #6

Updated by Anthony Chevalet over 7 years ago

Same behaviour with 1.15.3 and the new syntax

host_param('param_name')

Actions #7

Updated by Dis McCarthy about 7 years ago

Same here with 1.15.6-1. Safemode is off, render template shows the variables correctly but the actual userdata sent to the instance doesn't.

Has anyone found a workaround yet?

Actions #8

Updated by Anthony Chevalet about 7 years ago

My workaround is to use a tmp hostgroup at host creation...

Actions #9

Updated by Anthony Chevalet about 7 years ago

  • Status changed from Need more information to New
Actions #10

Updated by Marek Hulán almost 7 years ago

By rendering the template you mean preview the render while editing it? It might be caused by the fact that when the template is rendered for the host, different, system user account is used.

Actions #11

Updated by Anthony Chevalet almost 7 years ago

Yes, the preview while editing templates OR the 'Review' template on the host page (once created) show the parameter.

Actions #12

Updated by Anthony Chevalet over 6 years ago

  • Related to Bug #23104: Host parameters not available in foreman_hooks added
Actions #13

Updated by Anthony Chevalet over 6 years ago

  • Related to Bug #21618: hostgroup parameter does not show up in the PXE template added
Actions #14

Updated by Anthony Chevalet over 6 years ago

  • Related to Bug #21552: Host parameters added/updated via API do not make it to userscript on provisioning to EC2 added
Actions #15

Updated by Anthony Chevalet over 6 years ago

Still valid for 1.19RC3 ;)

Actions #16

Updated by Anonymous over 6 years ago

  • Found in Releases 1.19.0-RC3 added
Actions #17

Updated by Anthony Chevalet over 6 years ago

  • Subject changed from Host parameter not working in provisioning template to Host parameter not rendered in user_data template

As a precision, it impacts only user_data templates. Parameters are correctly rendered in Finish templates.

Actions #18

Updated by xioabin qu over 6 years ago

We're using PXELinux template, and is also impacted.

Actions #19

Updated by Ondrej Vesely about 6 years ago

Found also in 1.19.1-1.el7.
Affects Provisioning template, Finish template and PXELinux template.

Actions #20

Updated by Ondrej Vesely about 6 years ago

  • Found in Releases 1.19.1 added
  • Found in Releases deleted (1.14.3, 1.19.0-RC3)

I have upgraded to 1.20.0-1.el7 and the bug is there too.

Actions #21

Updated by Ondrej Vesely about 6 years ago

  • Found in Releases 1.15.3, 1.19.0-RC3, 1.20.0 added
Actions #22

Updated by Anthony Chevalet over 5 years ago

  • Found in Releases 1.21.3 added

still valid with 1.21.3

Actions

Also available in: Atom PDF