34 lines
1.2 KiB
Diff
34 lines
1.2 KiB
Diff
|
|
From b20753ac6db14999270d71387309baa9270aa927 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Vojtech Trefny <vtrefny@redhat.com>
|
||
|
|
Date: Thu, 13 Jan 2022 17:27:08 +0100
|
||
|
|
Subject: [PATCH] Show better error when using unitialized disk in
|
||
|
|
do_partitioning
|
||
|
|
|
||
|
|
Now all we get is "KeyError: '/dev/sda'" for example.
|
||
|
|
|
||
|
|
Related: rhbz#2017432
|
||
|
|
|
||
|
|
Conflict:NA
|
||
|
|
Reference:https://github.com/storaged-project/blivet/commit/b20753ac6db14999270d71387309baa9270aa927
|
||
|
|
|
||
|
|
---
|
||
|
|
blivet/partitioning.py | 5 ++++-
|
||
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
|
||
|
|
index f12ec3c9e..ce77e4eb7 100644
|
||
|
|
--- a/blivet/partitioning.py
|
||
|
|
+++ b/blivet/partitioning.py
|
||
|
|
@@ -764,7 +764,10 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None):
|
||
|
|
growth = 0 # in sectors
|
||
|
|
# loop through disks
|
||
|
|
for _disk in req_disks:
|
||
|
|
- disklabel = disklabels[_disk.path]
|
||
|
|
+ try:
|
||
|
|
+ disklabel = disklabels[_disk.path]
|
||
|
|
+ except KeyError:
|
||
|
|
+ raise PartitioningError("Requested disk %s doesn't have a usable disklabel for partitioning" % _disk.name)
|
||
|
|
best = None
|
||
|
|
current_free = free
|
||
|
|
try:
|