ref #2349 -- corregir error de sfdisk en disco no GPT

ogrepository-fixes
Vadim vtroshchinskiy 2025-06-27 13:51:54 +02:00
parent eecb19bef6
commit 749b1fee8d
1 changed files with 7 additions and 1 deletions

View File

@ -82,7 +82,13 @@ class DiskLibrary:
(disk, partno) = self.split_device_partition(device)
result = subprocess.run(["/usr/sbin/sfdisk", "--part-uuid", disk, str(partno)], check=True, capture_output=True, encoding='utf-8')
result = subprocess.run(["/usr/sbin/sfdisk", "--part-uuid", disk, str(partno)], check=False, capture_output=True, encoding='utf-8')
if result.returncode != 0:
# We're using a DOS partition table, no UUID.
if "failed to get partition UUID" in result.stderr:
return ""
raise subprocess.CalledProcessError(result.returncode, result.args)
return result.stdout.strip()
def set_partition_uuid(self, device, uuid):