47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
From 6817db6f11ffbaac511c5d43129473910c80736e Mon Sep 17 00:00:00 2001
|
|
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Date: Sat, 21 Mar 2020 18:06:51 +0800
|
|
Subject: [PATCH] check if disklabel supports partition names
|
|
|
|
pyparted now raises an exception when trying to access partition
|
|
name on a disklabel that doesn't support partition names, see
|
|
https://github.com/dcantrell/pyparted/issues/59
|
|
---
|
|
blivet/formats/disklabel.py | 7 +++++++
|
|
blivet/populator/helpers/boot.py | 1 +
|
|
2 files changed, 8 insertions(+)
|
|
|
|
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
|
|
index e13ab2f..125f2ba 100644
|
|
--- a/blivet/formats/disklabel.py
|
|
+++ b/blivet/formats/disklabel.py
|
|
@@ -329,6 +329,13 @@ class DiskLabel(DeviceFormat):
|
|
""" Device status. """
|
|
return False
|
|
|
|
+ @property
|
|
+ def supports_names(self):
|
|
+ if not self.supported or not self.parted_disk:
|
|
+ return False
|
|
+
|
|
+ return self.parted_disk.supportsFeature(parted.DISK_TYPE_PARTITION_NAME)
|
|
+
|
|
def _create(self, **kwargs):
|
|
""" Create the device. """
|
|
log_method_call(self, device=self.device,
|
|
diff --git a/blivet/populator/helpers/boot.py b/blivet/populator/helpers/boot.py
|
|
index 76eed22..5eee9ae 100644
|
|
--- a/blivet/populator/helpers/boot.py
|
|
+++ b/blivet/populator/helpers/boot.py
|
|
@@ -59,6 +59,7 @@ class MacEFIFormatPopulator(BootFormatPopulator):
|
|
fmt = formats.get_format(cls._type_specifier)
|
|
try:
|
|
return (super(MacEFIFormatPopulator, MacEFIFormatPopulator).match(data, device) and
|
|
+ device.disk.format.supports_names and
|
|
device.parted_partition.name == fmt.name)
|
|
except AttributeError:
|
|
# just in case device.parted_partition has no name attr
|
|
--
|
|
1.8.3.1
|
|
|