Skip to content

Commit

Permalink
Refs #36833 - Correct File.join call on bootloader-universe
Browse files Browse the repository at this point in the history
When using File.join, all components should be separate arguments.

Fixes: 1345bb4 ("Fixes #36833 - Add SecureBoot support for arbitrary operating systems to "Grub2 UEFI" PXE loaders")
  • Loading branch information
ekohl authored and ehelms committed Nov 27, 2024
1 parent 639102a commit 7060ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/tftp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def pxeconfig_file(mac)
class Pxegrub2 < Server
def bootloader_path(os, release, arch)
[release, "default"].each do |version|
bootloader_path = File.join(path, 'bootloader-universe/pxegrub2', os, version, arch)
bootloader_path = File.join(path, 'bootloader-universe', 'pxegrub2', os, version, arch)

logger.debug "TFTP: Checking if bootloader universe is configured for OS '#{os}' version '#{version}' (#{arch})."

Expand Down
6 changes: 3 additions & 3 deletions test/tftp/tftp_server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ def test_pxeconfig_dir
end

def test_release_specific_bootloader_path
release_specific_bootloader_path = File.join(@subject.path, "bootloader-universe/pxegrub2", @os, @release, @arch)
release_specific_bootloader_path = File.join(@subject.path, "bootloader-universe", "pxegrub2", @os, @release, @arch)
Dir.stubs(:exist?).with(release_specific_bootloader_path).returns(true).once
assert_equal release_specific_bootloader_path, @subject.bootloader_path(@os, @release, @arch)
end

def test_default_bootloader_path
release_specific_bootloader_path = File.join(@subject.path, "bootloader-universe/pxegrub2", @os, @release, @arch)
default_bootloader_path = File.join(@subject.path, "bootloader-universe/pxegrub2", @os, "default", @arch)
release_specific_bootloader_path = File.join(@subject.path, "bootloader-universe", "pxegrub2", @os, @release, @arch)
default_bootloader_path = File.join(@subject.path, "bootloader-universe", "pxegrub2", @os, "default", @arch)
Dir.stubs(:exist?).with(release_specific_bootloader_path).returns(false).once
Dir.stubs(:exist?).with(default_bootloader_path).returns(true).once
assert_equal default_bootloader_path, @subject.bootloader_path(@os, @release, @arch)
Expand Down

0 comments on commit 7060ce3

Please sign in to comment.