Skip to content

Commit

Permalink
Fixes #36626 - safe checks for the pxe_loader
Browse files Browse the repository at this point in the history
@host.pxe_loader returns empty string if it's
not set on the host or the hostgroup.
This fix issue in render phase when
@host.pxe_loader is nil and include? is called.

Create host form now require to select a PXE loader,
None or something else. Same as in the API.
  • Loading branch information
stejskalleos committed Aug 1, 2023
1 parent 1c3a415 commit f5336a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/host/managed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def explicit_pxe_loader
end

def pxe_loader
explicit_pxe_loader || hostgroup.try(:pxe_loader)
explicit_pxe_loader || hostgroup.try(:pxe_loader) || ''
end

def pxe_loader_efi?
Expand Down
2 changes: 1 addition & 1 deletion app/views/common/os_selection/_pxe_loader.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%>
<%= selectable_f f, :pxe_loader,
loaders.to_a, {
:include_blank => pxe_loader_selected,
:include_blank => false,
:selected => pxe_loader_selected == true ? f.object.pxe_loader : pxe_loader_selected
},
:label => _('PXE loader'),
Expand Down

0 comments on commit f5336a8

Please sign in to comment.