Skip to content

Commit

Permalink
always use real devices for generic mbr (found during manual testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Aug 30, 2016
1 parent 07837c3 commit e99a3a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/bootloader/mbr_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def disks_to_rewrite
ret = [mbr_disk]
# Add to disks only if part of raid on base devices lives on mbr_disk
ret.concat(mbrs) if mbrs.include?(mbr_disk)
# get only real disks
ret = ret.each_with_object([]) do |disk, res|
res.concat(::Bootloader::Stage1Device.new(disk).real_devices)
end

ret.uniq
end
Expand Down
14 changes: 14 additions & 0 deletions test/mbr_update_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def stage1(devices: [], activate: false, generic_mbr: false)
subject.run(stage1(generic_mbr: true))
end

it "always uses real devices" do
allow(Yast::BootStorage).to receive(:mbr_disk)
.and_return("/dev/md0")

allow(::Bootloader::Stage1Device).to receive(:new).with("/dev/md0")
.and_return(double(real_devices: ["/dev/sda1", "/dev/sdb1"]))
expect(Yast::Execute).to receive(:on_target).at_least(:twice) do |*args|
next nil unless args.first =~ /dd/
next nil unless args.include?("of=/dev/sdb")
expect(args).to be_include("of=/dev/sda")
end
subject.run(stage1(generic_mbr: true))
end

it "install syslinux if non on initial stage" do
allow(Yast::Stage).to receive(:initial).and_return(false)
expect(Yast::PackageSystem).to receive(:Install).with("syslinux")
Expand Down

0 comments on commit e99a3a7

Please sign in to comment.