More error handling and fixed a spelling error.
This commit is contained in:
parent
1a7056efc4
commit
2cfbafc653
|
|
@ -56,14 +56,17 @@ def load_config():
|
||||||
archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
|
archinstall.storage['_selected_servers'] = archinstall.arguments.get('servers', None)
|
||||||
if archinstall.arguments.get('disk_layouts', None) is not 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'):
|
if (dl_path := pathlib.Path(archinstall.arguments['disk_layouts'])).exists() and str(dl_path).endswith('.json'):
|
||||||
with open(dl_path) as fh:
|
try:
|
||||||
archinstall.arguments['disk_layouts'] = json.load(fh)
|
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:
|
else:
|
||||||
try:
|
try:
|
||||||
archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts'])
|
archinstall.arguments['disk_layouts'] = json.loads(archinstall.arguments['disk_layouts'])
|
||||||
except:
|
except:
|
||||||
raise ValueError("--disk_layouts=<json> needs either a JSON file or a JSON string given with a valid disk layout.")
|
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():
|
def ask_user_questions():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue