Bug 1382735
Summary: | [RFE] Allow accessing all template names for a host (in safe mode) | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
Component: | Provisioning Templates | Assignee: | Daniel Lobato Garcia <dlobatog> |
Status: | CLOSED ERRATA | QA Contact: | Lukas Zapletal <lzap> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.2.2 | CC: | bbuckingham, bkearney, brubisch, dlobatog, jcallaha, lzap, mhulan, peter.vreman |
Target Milestone: | Unspecified | Keywords: | EasyFix, FutureFeature, Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | http://projects.theforeman.org/issues/17680 | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-02-21 12:35:52 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1122832 |
Description
Peter Vreman
2016-10-07 14:29:13 UTC
Proposed patch: --- /usr/share/foreman/app/models/host/managed.rb +++ /usr/share/foreman/app/models/host/managed.rb @@ -74,7 +74,7 @@ :image_build?, :pxe_build?, :otp, :realm, :param_true?, :param_false?, :nil?, :indent, :primary_interface, :provision_interface, :interfaces, :bond_interfaces, :bridge_interfaces, :interfaces_with_identifier, :managed_interfaces, :facts, :facts_hash, :root_pass, :sp_name, :sp_ip, :sp_mac, :sp_subnet, :use_image, - :multiboot, :jumpstart_path, :install_path, :miniroot, :medium + :multiboot, :jumpstart_path, :install_path, :miniroot, :medium, :templates_used end scope :recent, ->(*args) { where(["last_report > ?", (args.first || (Setting[:puppet_interval] + Setting[:outofsync_interval]).minutes.ago)]) } @@ -838,6 +838,12 @@ end.compact end + def templates_used + b = {} + available_template_kinds.map { |p| b[p.template_kind_name]=p.name } + b + end + def render_template(template) @host = self load_template_vars Hello, you could use Operating System - Parameters. You can set arbitrary amount of parameters for each operating system you have and use these in your PXELinux templates, or wherever you like. Example: * Visit OS - Edit - Parameters * Enter new parameter with name "test" and arbitrary value * Edit PXELinux template: ... KERNEL <%= @kernel %> <%= @host.params['test'] %> ... * Save, install an OS Lukas, The global OS level parameters does not support lifecycles as Katello does. The OS parameter is 'Library'. But how to make the OS parameter available for a lifecycle promotion path Library-Development-QAS-Production ? We solve this challenge of having different releases by using a templates with a version in the name and then using a specified version for each Lifeycle environment. Kickstart-6.8.1 Kickstart-6.8.2 Kickstart-6.8.3 These are all for the same RHEL6.8, but the content of the %post is different and relies on the kernel parameters. Peter, I misunderstood your RFE. Satellite 6.1 contains variable called @template_name which returns the current template name, you could use it in your code to read the parameter. Under some conditions (when there's snippet included), the variable may contain incorrect name. This has been fixed in 6.3 version (upcoming version of Satellite). Let me know if this gets you what you need. Hoi Lukas, The @template_name is like you write the current template. When i render a PXE then it is the name of the PXE template. I would like to know the name of the Provisioning template during the rendering of a PXE template. Peter Okay, exposing all template names should not be any problem. We will look into this. Created redmine issue http://projects.theforeman.org/issues/17680 from this bug Submitted upstream as https://github.com/theforeman/foreman/pull/4115 - once it's merged I'll set to POST & propose for 6.2. Thanks Peter! Upstream bug component is Provisioning Upstream bug component is Provisioning Templates Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17680 has been resolved. [root@zzzap ~]# rpm -q foreman katello foreman-1.15.2-1.el7sat.noarch katello-3.4.4-2.el7sat.noarch Created PXELinux template: <%= @host.templates_used %> Result: {"PXELinux"=>"Kickstart default PXELinux - template used", "iPXE"=>"Kickstart default iPXE", "provision"=>"Satellite Kickstart Default", "finish"=>"Satellite Kickstart Default Finish", "user_data"=>"Satellite Kickstart Default User Data", "kexec"=>"Discovery Red Hat kexec"} Safe-mode was enabled. Works. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:0336 |