Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
The "ForemanBootdisk::Scope::FullHostBootdisk" scope class is not parsed into the snippet template which causes snippet to render with the default scope class("Foreman::Renderer::Scope::Provisioning").
In "/usr/share/foreman/lib/foreman/renderer/scope/macros/snippet_rendering.rb"
--------------------------------
def snippet(name, options = {}, variables: {})
<snip>
begin
snippet_variables = variables.merge(options[:variables] || {})
template.render(host: host, variables: snippet_variables, mode: mode) <==== missing scope class argument.
---------------------------------
In "/usr/share/foreman/app/models/template.rb". No scope class provided for "get_scope" method so "Foreman::Renderer::Scope::Provisioning" is used for snippet.
--------------------------------
def render(host: nil, params: {}, variables: {}, mode: Foreman::Renderer::REAL_MODE, template_input_values: {})
source = Foreman::Renderer.get_source(template: self, host: host)
scope = Foreman::Renderer.get_scope(host: host, params: params, variables: variables, mode: mode, template: self, source: source, template_input_values: template_input_values)
Foreman::Renderer.render(source, scope)
end
--------------------------------
Steps to Reproduce:
1. Clone the "Kickstart default PXELinux". Rename it to "Kickstart default PXELinux Custom" and set proper Locations and Orgs and include all Operating systems
2. Create a snippet called "Sub PXELinux Custom"
3. Edit the cloned template and Cut the following block and paste it to the snippet.
<%
major = @host.operatingsystem.major.to_i
mac = @host.provision_interface.mac
# Tell Anaconda to perform network functions with boot interface
# both current and legacy syntax provided
options = ["network", "ksdevice=bootif", "ks.device=bootif"]
if mac
bootif = '00-' + mac.gsub(':', '-')
options.push("BOOTIF=#{bootif}")
end
# Tell Anaconda what to pass off to kickstart server
# both current and legacy syntax provided
options.push("kssendmac", "ks.sendmac", "inst.ks.sendmac")
# handle non-DHCP environments (e.g. bootdisk)
subnet = @host.provision_interface.subnet
unless subnet.dhcp_boot_mode?
# static network configuration
ip = @host.provision_interface.ip
mask = subnet.mask
gw = subnet.gateway
dns = [subnet.dns_primary]
if subnet.dns_secondary != ''
dns.push(subnet.dns_secondary)
end
if (@host.operatingsystem.name.match(/Fedora/i) && major < 17) || major < 7
# old Anacoda found in Fedora 16 or RHEL 6 and older
dns_servers = dns.join(',')
options.push("ip=#{ip}", "netmask=#{mask}", "gateway=#{gw}", "dns=#{dns_servers}")
else
options.push("ip=#{ip}::#{gw}:#{mask}:::none")
dns.each { |server|
options.push("nameserver=#{server}")
}
end
end
# optional repository for Atomic
if @host.operatingsystem.name.match(/Atomic/i)
options.push("inst.repo=#{medium_uri}")
end
if @host.operatingsystem.name.match(/Atomic/i) || host_param('kickstart_liveimg')
options.push('inst.stage2=' + @host.operatingsystem.medium_uri(@host).to_s)
end
ksoptions = options.join(' ')
timeout = host_param('loader_timeout').to_i * 10
timeout = 100 if timeout.nil? || timeout <= 0
-%>
DEFAULT menu
MENU TITLE Booting into OS installer (ESC to stop)
TIMEOUT <%= timeout %>
ONTIMEOUT installer
LABEL installer
MENU LABEL <%= template_name %>
KERNEL <%= @kernel %>
APPEND initrd=<%= @initrd %> ks=<%= foreman_url('provision') %> <%= pxe_kernel_options %> <%= ksoptions %>
IPAPPEND 2
4. Call the snippet in the cloned template by adding the following line.
<%= snippet "Sub PXELinux Custom" %>
5. Assign the "Kickstart default PXELinux Custom" template to a Operating system. For example RHEL 7.7.
6. Create a host and assign the RHEL 7.7 Operating system to it.
7. Go to the host page and click Book disk -> "Full host 'some hostname' image" to download the full bootdisk.
8. Mount the downloaded bootdisk and inspect contents. You will notice that the "initrd_img" and the "vmlinux" filename are mismatch between /boot directory can the isolinux.cfg.
# The filenames in isolinux.cfg are not converted to ISO9660 standard.
"art_x86_64_7_6_22_initrd_img" VS "red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-initrd.img"
"kstart_x86_64_7_6_22_vmlinuz" VS "red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-vmlinuz"
# tree
.
├── boot
│ ├── art_x86_64_7_6_22_initrd_img
│ └── kstart_x86_64_7_6_22_vmlinuz
├── boot.cat
├── isolinux.bin
└── isolinux.cfg
# cat isolinux.cfg
DEFAULT menu
MENU TITLE Booting into OS installer (ESC to stop)
TIMEOUT 100
ONTIMEOUT installer
LABEL installer
MENU LABEL Sub PXELinux Custom
KERNEL boot/red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-vmlinuz
APPEND initrd=boot/red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-initrd.img ks=http://hao-satellite64.usersys.redhat.com:8000/unattended/provision?token=47e41f2e-2c36-43b5-afe0-376a4bbfca45 network ksdevice=bootif ks.device=bootif BOOTIF=00-56-6f-04-50-00-31 kssendmac ks.sendmac inst.ks.sendmac ip=::10.71.133.25:255.255.255.0:::none nameserver=10.71.133.25
IPAPPEND 2
Actual results:
"initrd_img" and the "vmlinux" filename are mismatch between /boot directory can the isolinux.cfg.
Expected results:
Filename must match and converted to meet ISO9660 standard.
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 (Moderate: Satellite 6.11 Release), 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-2022:5498
Comment 18Red Hat Bugzilla
2023-09-15 01:28:52 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days
Description of problem: The "ForemanBootdisk::Scope::FullHostBootdisk" scope class is not parsed into the snippet template which causes snippet to render with the default scope class("Foreman::Renderer::Scope::Provisioning"). In "/usr/share/foreman/lib/foreman/renderer/scope/macros/snippet_rendering.rb" -------------------------------- def snippet(name, options = {}, variables: {}) <snip> begin snippet_variables = variables.merge(options[:variables] || {}) template.render(host: host, variables: snippet_variables, mode: mode) <==== missing scope class argument. --------------------------------- In "/usr/share/foreman/app/models/template.rb". No scope class provided for "get_scope" method so "Foreman::Renderer::Scope::Provisioning" is used for snippet. -------------------------------- def render(host: nil, params: {}, variables: {}, mode: Foreman::Renderer::REAL_MODE, template_input_values: {}) source = Foreman::Renderer.get_source(template: self, host: host) scope = Foreman::Renderer.get_scope(host: host, params: params, variables: variables, mode: mode, template: self, source: source, template_input_values: template_input_values) Foreman::Renderer.render(source, scope) end -------------------------------- Steps to Reproduce: 1. Clone the "Kickstart default PXELinux". Rename it to "Kickstart default PXELinux Custom" and set proper Locations and Orgs and include all Operating systems 2. Create a snippet called "Sub PXELinux Custom" 3. Edit the cloned template and Cut the following block and paste it to the snippet. <% major = @host.operatingsystem.major.to_i mac = @host.provision_interface.mac # Tell Anaconda to perform network functions with boot interface # both current and legacy syntax provided options = ["network", "ksdevice=bootif", "ks.device=bootif"] if mac bootif = '00-' + mac.gsub(':', '-') options.push("BOOTIF=#{bootif}") end # Tell Anaconda what to pass off to kickstart server # both current and legacy syntax provided options.push("kssendmac", "ks.sendmac", "inst.ks.sendmac") # handle non-DHCP environments (e.g. bootdisk) subnet = @host.provision_interface.subnet unless subnet.dhcp_boot_mode? # static network configuration ip = @host.provision_interface.ip mask = subnet.mask gw = subnet.gateway dns = [subnet.dns_primary] if subnet.dns_secondary != '' dns.push(subnet.dns_secondary) end if (@host.operatingsystem.name.match(/Fedora/i) && major < 17) || major < 7 # old Anacoda found in Fedora 16 or RHEL 6 and older dns_servers = dns.join(',') options.push("ip=#{ip}", "netmask=#{mask}", "gateway=#{gw}", "dns=#{dns_servers}") else options.push("ip=#{ip}::#{gw}:#{mask}:::none") dns.each { |server| options.push("nameserver=#{server}") } end end # optional repository for Atomic if @host.operatingsystem.name.match(/Atomic/i) options.push("inst.repo=#{medium_uri}") end if @host.operatingsystem.name.match(/Atomic/i) || host_param('kickstart_liveimg') options.push('inst.stage2=' + @host.operatingsystem.medium_uri(@host).to_s) end ksoptions = options.join(' ') timeout = host_param('loader_timeout').to_i * 10 timeout = 100 if timeout.nil? || timeout <= 0 -%> DEFAULT menu MENU TITLE Booting into OS installer (ESC to stop) TIMEOUT <%= timeout %> ONTIMEOUT installer LABEL installer MENU LABEL <%= template_name %> KERNEL <%= @kernel %> APPEND initrd=<%= @initrd %> ks=<%= foreman_url('provision') %> <%= pxe_kernel_options %> <%= ksoptions %> IPAPPEND 2 4. Call the snippet in the cloned template by adding the following line. <%= snippet "Sub PXELinux Custom" %> 5. Assign the "Kickstart default PXELinux Custom" template to a Operating system. For example RHEL 7.7. 6. Create a host and assign the RHEL 7.7 Operating system to it. 7. Go to the host page and click Book disk -> "Full host 'some hostname' image" to download the full bootdisk. 8. Mount the downloaded bootdisk and inspect contents. You will notice that the "initrd_img" and the "vmlinux" filename are mismatch between /boot directory can the isolinux.cfg. # The filenames in isolinux.cfg are not converted to ISO9660 standard. "art_x86_64_7_6_22_initrd_img" VS "red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-initrd.img" "kstart_x86_64_7_6_22_vmlinuz" VS "red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-vmlinuz" # tree . ├── boot │ ├── art_x86_64_7_6_22_initrd_img │ └── kstart_x86_64_7_6_22_vmlinuz ├── boot.cat ├── isolinux.bin └── isolinux.cfg # cat isolinux.cfg DEFAULT menu MENU TITLE Booting into OS installer (ESC to stop) TIMEOUT 100 ONTIMEOUT installer LABEL installer MENU LABEL Sub PXELinux Custom KERNEL boot/red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-vmlinuz APPEND initrd=boot/red-hat-enterprise-linux-7-server-kickstart-x86_64-7-6-22-initrd.img ks=http://hao-satellite64.usersys.redhat.com:8000/unattended/provision?token=47e41f2e-2c36-43b5-afe0-376a4bbfca45 network ksdevice=bootif ks.device=bootif BOOTIF=00-56-6f-04-50-00-31 kssendmac ks.sendmac inst.ks.sendmac ip=::10.71.133.25:255.255.255.0:::none nameserver=10.71.133.25 IPAPPEND 2 Actual results: "initrd_img" and the "vmlinux" filename are mismatch between /boot directory can the isolinux.cfg. Expected results: Filename must match and converted to meet ISO9660 standard.