Feature #17680

Allow accessing all template names for a host (in safe mode)

Added by Daniel Lobato Garcia over 1 year ago. Updated 7 days ago.

Assignee:Daniel Lobato Garcia
Target version:1.15.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link:1382735 Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/4115


Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1382735
Description of problem:
We have multiple release of RHEL x.y and for each release there is a kickstart template. Each kcikstart template requires a different set of kernel parameters to be supplied.
We do not like to hardcode these parameters in the PXE templates because that is unmaintenable because the template logic and parameters are then separated.

This RFE would like to have the hash of templates_used[<kindname>] available in both:
- Host API
- Template rendering under @host

use case PXE template using @host.templates_used['provisioning'] to include parameters on the kernel command line that are prefixed with the provisioning template name.
default linux
label linux
kernel <%= @kernel %>
<%= @host.inspect %>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%> network <%= @host.params[@host.templates_used['provisioning']+'_kernel_opts'] || "" %> <%= @host.params['ks_kernel_opts'] || "" %>
ipappend 2

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Set common parameter 'TemplateABC_kernel_options' with value 'ABCDEF'
2. Create provisiong template 'TemplateABC' (content not relevant)
2. Create pxe template 'PXETemplateABC' with the content below
kernel options: XXX<%= @host.params[@host.templates_used['provisioning']+'_kernel_opts'] %>ZZZ
3. Create HostA
4. Associate HostA with TemplateABC and PXETemplateABC
5. Render PXETemplateABC

Actual results:
Output of 'kernel options: XXXZZZ' where the parmaeter is empty

Expected results:
Output of 'kernel options: XXXABCDEFZZZ' where the parameter with the provisioning template name is replaced

Additional info:

Associated revisions

Revision 22439f75
Added by Daniel Lobato Garcia over 1 year ago

Fixes #17680 - templates_used host helper

templates_used contains the names of all of the provisioning templates
kickstart used during a host build. This allows users to be able to
show the name of a provisioning template during PXEBoot, for example


#1 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Assignee set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4115 added

#2 Updated by Ivan Necas over 1 year ago

  • Category set to Templates

#3 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 1.15.5

#4 Updated by Anonymous over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Dominic Cleal over 1 year ago

  • Legacy Backlogs Release (now unused) set to 209

#6 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version changed from 1.15.5 to 169

#7 Updated by Brad Buckingham over 1 year ago

  • Target version deleted (169)

#8 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 1.11.0

Also available in: Atom PDF