diff --git a/check-if-disklabel-supports-partition-names.patch b/check-if-disklabel-supports-partition-names.patch new file mode 100644 index 0000000000000000000000000000000000000000..d28d0475d3ce948ea0139289d2dc214358b822e0 --- /dev/null +++ b/check-if-disklabel-supports-partition-names.patch @@ -0,0 +1,46 @@ +From 6817db6f11ffbaac511c5d43129473910c80736e Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +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 + diff --git a/python-blivet.spec b/python-blivet.spec index 856436b18690bf4e475724539f79bc5fc7cb19e5..7d876ff126afdbc90e82965770c5feffcb78b1d5 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -2,7 +2,7 @@ Name: python-blivet Version: 3.1.1 -Release: 6 +Release: 7 Epoch: 1 Summary: A python module for system storage configuration License: LGPLv2+ @@ -21,6 +21,9 @@ Patch1: 0002-Fix-options-for-ISCSI-functions-1632656.patch Patch9000: fix-the-long-hostname.patch +# from upstream https://github.com/dcantrell/pyparted/issues/59 +Patch6000: check-if-disklabel-supports-partition-names.patch + %description The python-blivet package is a python module for examining and modifying storage configuration. @@ -119,6 +122,12 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install %doc README %changelog +* Sat Mar 21 2020 hexiujun - 3.1.1-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:check if disklabel supports partition names + * Sat Mar 14 2020 hexiujun - 3.1.1-6 - Type:enhancement - ID:NA