Skip to content

Commit 210f246

Browse files
committed
use existing get_grub_device instead of new get_grub_devices
newer versions of leapp deprecated get_grub_device and use get_grub_devices instead which support raid, etc our version does not support multiple grub devices, so use legacy functions instead
1 parent e05bbad commit 210f246

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

repos/system_upgrade/el7toel8/actors/checklegacygrub/libraries/check_legacy_grub.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ def has_legacy_grub(device):
2828

2929
def check_grub_disks_for_legacy_grub():
3030
# Both GRUB2 and Grub Legacy are recognized by `get_grub_devices`
31-
grub_devices = grub_lib.get_grub_devices()
31+
# oshyshatskyi: newer versions of leapp support multiple grub devices e.g. for raid
32+
# because our version does not support that, we always check only one device
33+
# https://github.com/oamg/leapp-repository/commit/2ba44076625e35aabfd2a1f9e45b2934f99f1e8d
34+
grub_device = grub_lib.get_grub_device()
35+
grub_devices = []
36+
if grub_device:
37+
grub_devices.append(grub_device)
3238

3339
legacy_grub_devices = []
3440
for device in grub_devices:

repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ScanGRUBDevicePartitionLayout(Actor):
1010
"""
1111

1212
name = 'scan_grub_device_partition_layout'
13-
consumes = (GrubInfo,)
13+
consumes = ()
1414
produces = (GRUBDevicePartitionLayout,)
1515
tags = (FactsPhaseTag, IPUWorkflowTag,)
1616

repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from leapp.libraries.stdlib import api, CalledProcessError, run
2-
from leapp.models import GRUBDevicePartitionLayout, GrubInfo, PartitionInfo
2+
from leapp.models import GRUBDevicePartitionLayout, PartitionInfo
3+
from leapp.libraries.common import grub
34

45
SAFE_OFFSET_BYTES = 1024*1024 # 1MiB
56

@@ -82,11 +83,20 @@ def get_partition_layout(device):
8283

8384

8485
def scan_grub_device_partition_layout():
85-
grub_devices = next(api.consume(GrubInfo), None)
86-
if not grub_devices:
86+
# oshyshatskyi: newer versions of leapp support multiple grub devices e.g. for raid
87+
# because our version does not support that, we always check only one device
88+
# https://github.com/oamg/leapp-repository/commit/2ba44076625e35aabfd2a1f9e45b2934f99f1e8d
89+
grub_device = grub.get_grub_device()
90+
if not grub_device:
8791
return
88-
89-
for device in grub_devices.orig_devices:
92+
grub_devices = [grub_device]
93+
94+
# oshyshatskyi: originally rhel used actor to collect information
95+
# but we are too out of date to cherry-pick it
96+
# anyway, actor did the same thing:
97+
# devices = grub.get_grub_devices()
98+
# grub_info = GrubInfo(orig_devices=devices)
99+
for device in grub_devices:
90100
dev_info = get_partition_layout(device)
91101
if dev_info:
92102
api.produce(dev_info)

0 commit comments

Comments
 (0)