Hide Forgot
Description of problem: When using Synced Content is set on a hostgroup it is not included in the Global PXE default menu. The reason is that the medium_id is not set in case the Synced Content is used. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Create Hsotgroup and use Synced Content for Isntallation Media 2. Make sure that the Hostgroups have medium_id set to null 3. Alternative is to use the API to set the medium_id explicit to null 4. Create PXE default menu Actual results: Hostgroup that has Isntallation Media set to Sync Content (medium_id=null) is not included Expected results: Also Hostgroups with Isntallation Media on Synced Content Additional info:
--- /usr/share/foreman/app/models/provisioning_template.rb +++ /usr/share/foreman/app/models/provisioning_template.rb @@ -184,10 +184,10 @@ # generated for def self.pxe_default_combos combos = [] - ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture, :medium]}]).each do |template| + ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture]}]).each do |template| template.template_combinations.each do |combination| hostgroup = combination.hostgroup - if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.medium + if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.operatingsystem.medium_uri(hostgroup) combos << {:hostgroup => hostgroup, :template => template} end end
Udpated patch to fix also the pxe_files() call that missed the Host paramter that is now neded to for Katello integration --- /usr/share/foreman/app/models/provisioning_template.rb +++ /usr/share/foreman/app/models/provisioning_template.rb @@ -141,7 +141,7 @@ tftp.create_default({:menu => menu}) @profiles.each do |combo| - combo[:hostgroup].operatingsystem.pxe_files(combo[:hostgroup].medium, combo[:hostgroup].architecture).each do |bootfile_info| + combo[:hostgroup].operatingsystem.pxe_files(combo[:hostgroup].medium, combo[:hostgroup].architecture, combo[:hostgroup]).each do |bootfile_info| for prefix, path in bootfile_info do tftp.fetch_boot_file(:prefix => prefix.to_s, :path => path) end @@ -184,10 +184,10 @@ # generated for def self.pxe_default_combos combos = [] - ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture, :medium]}]).each do |template| + ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture]}]).each do |template| template.template_combinations.each do |combination| hostgroup = combination.hostgroup - if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.medium + if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.operatingsystem.medium_uri(hostgroup) combos << {:hostgroup => hostgroup, :template => template} end end
Updated patch to skip entries that had errors instead of failing with a generic useless error for the user --- /usr/share/foreman/app/models/provisioning_template.rb +++ /usr/share/foreman/app/models/provisioning_template.rb @@ -141,7 +141,7 @@ tftp.create_default({:menu => menu}) @profiles.each do |combo| - combo[:hostgroup].operatingsystem.pxe_files(combo[:hostgroup].medium, combo[:hostgroup].architecture).each do |bootfile_info| + combo[:hostgroup].operatingsystem.pxe_files(combo[:hostgroup].medium, combo[:hostgroup].architecture, combo[:hostgroup]).each do |bootfile_info| for prefix, path in bootfile_info do tftp.fetch_boot_file(:prefix => prefix.to_s, :path => path) end @@ -184,11 +184,17 @@ # generated for def self.pxe_default_combos combos = [] - ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture, :medium]}]).each do |template| + ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture]}]).each do |template| template.template_combinations.each do |combination| hostgroup = combination.hostgroup - if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.medium - combos << {:hostgroup => hostgroup, :template => template} + if hostgroup and hostgroup.operatingsystem and hostgroup.architecture + begin + if hostgroup.operatingsystem.medium_uri(hostgroup) + combos << {:hostgroup => hostgroup, :template => template} + end + rescue => e + nil + end end end end
Peter, thanks for the patches, they look good at first sight, would you mind filing them as PRs in our git repo: https://github.com/theforeman/foreman Our CI will perform unit tests and we can take it from there.
Lukas, Sorry my work only permits me to focus on using Sat6 in our environemnt. I have created patches to unblock my use cases where i was unable to create a workaround. For all patches i have created i have opened BZs and RedHat Cases. Peter
Sure, https://github.com/theforeman/foreman/pull/4874
Created attachment 1357864 [details] Proposed patch - foreman 1.15 Proposed patch for foreman 1.15
Note that the patch also contains an additional rescue around the medium_uri call that might raise and exception sometimes. To prevent full abort of the PXE global menu generation i added the rescue block. Improvement might be to add an error/warning that the combo failed and is skipped.
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Rich Jerrido or Bryan Kearney or your account team. If we do not hear from you, we will close this bug out. Thank you.
Bryan, Why is this being closed? The default pxe menu is a faeture and this a BUG that prevents entries from being int he menu. Secondly there is a patched attached to fix it! For us this patch is a critical piece of our deployment workflow. What do you need more than a patch for a BUG to get this fixed? Peter
Thanks Peter. The bug was not connected to Redmine correctly, so it was not updated. I just checked and Lzap has already merged your patch and this will be in 6.5. I will do the appropriate steps now to make sure the bug reflects the current state.
Connecting redmine issue https://projects.theforeman.org/issues/21105 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/21105 has been resolved.
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.
Bah.. missed this on my list. Moving back to ON_QA since it was delivered in Snap 7.
Thx Bryan! Oliver
Hi! Still the bug is seen in 6.5 HTB! Thx, Oliver
Patch against 6.5.0 --------- --- /usr/share/foreman/app/models/provisioning_template.rb +++ /usr/share/foreman/app/models/provisioning_template.rb @@ -208,18 +208,22 @@ # generated for def self.pxe_default_combos combos = [] - ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture, :medium]}]).each do |template| + ProvisioningTemplate.joins(:template_kind).where("template_kinds.name" => "provision").includes(:template_combinations => [:environment, {:hostgroup => [ :operatingsystem, :architecture]}]).each do |template| template.template_combinations.each do |combination| hostgroup = combination.hostgroup - if hostgroup&.operatingsystem && hostgroup.architecture && hostgroup.medium + if hostgroup&.operatingsystem && hostgroup.architecture medium_provider = Foreman::Plugin.medium_providers.find_provider(hostgroup) - combos << { - :hostgroup => hostgroup, - :template => template, - :kernel => hostgroup.operatingsystem.kernel(medium_provider), - :initrd => hostgroup.operatingsystem.initrd(medium_provider), - :pxe_type => hostgroup.operatingsystem.pxe_type - } + if medium_provider + combos << { + :hostgroup => hostgroup, + :template => template, + :kernel => hostgroup.operatingsystem.kernel(medium_provider), + :initrd => hostgroup.operatingsystem.initrd(medium_provider), + :pxe_type => hostgroup.operatingsystem.pxe_type + } + else + Rails.logger.warn "Could not find medium_provider for hostgroup #{hostgroup}, skipping" + end end end end ------------
Lzap, can you take a look
Hello, I have tested the patch and wrote tests for this case so it will not regress again. The PR is pending review: https://github.com/theforeman/foreman/pull/6570
so, tested this on 6.5.0-20 and the HG menu entries are indeed created now (even for HG's that use the synced content). I guess that's what verifies this BZ. However, just for the record - the HG-based provisioning seems to be broken. First, there is a problem described in: https://bugzilla.redhat.com/show_bug.cgi?id=1694048 - there is already a PR for this upstream, however, there is another problem: https://projects.theforeman.org/issues/25753 which currently blocks the provisioning.
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-2019:1222