Project

General

Profile

Actions

Feature #17680

closed

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

Added by Daniel Lobato Garcia over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Templates
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

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:

Actions #1

Updated by The Foreman Bot over 7 years 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
Actions #2

Updated by Ivan Necas over 7 years ago

  • Category set to Templates
Actions #3

Updated by Daniel Lobato Garcia over 7 years ago

  • Target version set to 1.15.5
Actions #4

Updated by Anonymous about 7 years ago

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

Updated by Dominic Cleal about 7 years ago

  • translation missing: en.field_release set to 209
Actions #6

Updated by Daniel Lobato Garcia about 7 years ago

  • Target version changed from 1.15.5 to 169
Actions #7

Updated by Brad Buckingham about 7 years ago

  • Target version deleted (169)
Actions #8

Updated by Daniel Lobato Garcia about 7 years ago

  • Target version set to 1.11.0
Actions

Also available in: Atom PDF