Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-09-15 19:16:30 +0200
committerAnton Hvornum <anton@hvornum.se>2021-09-15 19:16:30 +0200
commit2cfbafc6534ebcca7e8d52be263aed4d54c04914 (patch)
tree47e29e5ae58213aa0a95490230a64225f8f03950 /examples
parent1a7056efc40a336a855be353f549af0eb7e0fca9 (diff)
More error handling and fixed a spelling error.
Diffstat (limited to 'examples')
-rw-r--r--examples/guided.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/guided.py b/examples/guided.py
index e5cf2d38..10f4c9eb 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -56,14 +56,17 @@ def load_config():
archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
if archinstall.arguments.get('disk_layouts', None) is not None:
if (dl_path := pathlib.Path(archinstall.arguments['disk_layouts'])).exists() and str(dl_path).endswith('.json'):
- with open(dl_path) as fh:
- archinstall.arguments['disk_layouts'] = json.load(fh)
+ try:
+ with open(dl_path) as fh:
+ archinstall.arguments['disk_layouts'] = json.load(fh)
+ except Exception as e:
+ raise ValueError(f"--disk_layouts does not contain a valid JSON format: {e}")
else:
try:
archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts'])
except:
raise ValueError("--disk_layouts=<json> needs either a JSON file or a JSON string given with a valid disk layout.")
- archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts']}
+ archinstall.storage['disk_layouts'] = {archinstall.BlockDevice(disk) : struct for disk, struct in archinstall.arguments['disk_layouts'].items()}
def ask_user_questions():