Bug 1449290
Summary: | Global PXE hostgroups menu entries missing when Installation Media is set to Synced Content | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> | ||||
Component: | Provisioning | Assignee: | Lukas Zapletal <lzap> | ||||
Status: | CLOSED ERRATA | QA Contact: | Roman Plevka <rplevka> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 6.5.0 | CC: | bkearney, egolov, hmore, inecas, jcallaha, lzap, ofalk, pcreech | ||||
Target Milestone: | 6.5.0 | Keywords: | Reopened, Triaged | ||||
Target Release: | Unused | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
URL: | https://github.com/theforeman/foreman/pull/4874 | ||||||
Whiteboard: | |||||||
Fixed In Version: | foreman-1.20.1.28-1 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2019-05-14 12:36:19 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 | ||||||
Attachments: |
|
Description
Peter Vreman
2017-05-09 14:22:19 UTC
--- /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 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 |