Feature #17680
closedAllow accessing all template names for a host (in safe mode)
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: