Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/blockdevice.py
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2021-11-10 11:20:38 +0100
committerWerner Llácer <wllacer@gmail.com>2021-11-10 11:20:38 +0100
commit671c7b38545079136f804e0fb5b77e21f0dba44f (patch)
treef6817ffe6115b9a7f9a82c494a650b8986e77982 /archinstall/lib/disk/blockdevice.py
parentb7fcbf13bc1d3d1b1a6255d6eb2986149fa56982 (diff)
Solves issue #689. Attribute Error.'None type' has no attribute 'format' ...
It seems the system does not syncronus update its internal information after a partitioning. Two places are affected. Directly on filesystem.add_partition (the uuid of the new partition isn't available after the parted command) and blockdevice.get_partition, where the list of partitions for the iterator might not be available in the query. The patch places both sections under controlled loops, giving the system the chance to update the information. Should be more controlled via application parameters
Diffstat (limited to 'archinstall/lib/disk/blockdevice.py')
-rw-r--r--archinstall/lib/disk/blockdevice.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/archinstall/lib/disk/blockdevice.py b/archinstall/lib/disk/blockdevice.py
index 048e51f4..493e5383 100644
--- a/archinstall/lib/disk/blockdevice.py
+++ b/archinstall/lib/disk/blockdevice.py
@@ -1,9 +1,11 @@
import os
import json
import logging
+import time
from ..exceptions import DiskError
from ..output import log
from ..general import SysCommand
+from ..storage import storage
GIGA = 2 ** 30
@@ -213,6 +215,15 @@ class BlockDevice:
self.part_cache = {}
def get_partition(self, uuid):
- for partition in self:
- if partition.uuid == uuid:
- return partition
+ count = 0
+ while count < 5:
+ for partition in self:
+ if partition.uuid == uuid:
+ return partition
+ else:
+ log(f"uuid {uuid} not found. Waiting for {count +1} time",level=logging.DEBUG)
+ time.sleep(float(storage['arguments'].get('disk-sleep', 0.2)))
+ count +=1
+ else:
+ log(f"Could not find {uuid} in disk after 5 retries",level=logging.INFO)
+ raise DiskError(f"New partition {uuid} never showed up after adding new partition on {self}")