Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def get_partition_layout(device):
if not line.startswith('Device'):
continue

part_all_attrs = split_on_space_segments(line)
break

partitions = []
Expand All @@ -76,7 +75,7 @@ def get_partition_layout(device):

# If the partition is not bootable, the Boot column might be empty
part_device = part_info[0]
part_start = int(part_info[2]) if len(part_info) == len(part_all_attrs) else int(part_info[1])
part_start = int(part_info[2]) if part_info[1] == '*' else int(part_info[1])
partitions.append(PartitionInfo(part_device=part_device, start_offset=part_start*unit))

return GRUBDevicePartitionLayout(device=device, partitions=partitions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
)
]
)
def test_get_partition_layout(monkeypatch, devices):
@pytest.mark.parametrize('fs', ('Linux', 'Linux raid autodetect'))
def test_get_partition_layout(monkeypatch, devices, fs):
device_to_fdisk_output = {}
for device in devices:
fdisk_output = [
Expand All @@ -45,7 +46,7 @@ def test_get_partition_layout(monkeypatch, devices):
' Device Boot Start End Blocks Id System',
]
for part in device.partitions:
part_line = '{0} * {1} 2099199 1048576 83 Linux'.format(part.name, part.start_offset)
part_line = '{0} * {1} 2099199 1048576 83 {2}'.format(part.name, part.start_offset, fs)
fdisk_output.append(part_line)

device_to_fdisk_output[device.name] = fdisk_output
Expand Down