Added error handling to fstab (#1045)
* Added error handling to fstab * Checking the exit code for == 0
This commit is contained in:
parent
c92c448f29
commit
77bfa10d53
|
|
@ -380,11 +380,14 @@ class Installer:
|
|||
def genfstab(self, flags :str = '-pU') -> bool:
|
||||
self.log(f"Updating {self.target}/etc/fstab", level=logging.INFO)
|
||||
|
||||
if not (fstab := SysCommand(f'/usr/bin/genfstab {flags} {self.target}')).exit_code == 0:
|
||||
raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n Error: {fstab}')
|
||||
|
||||
with open(f"{self.target}/etc/fstab", 'a') as fstab_fh:
|
||||
fstab_fh.write((fstab := SysCommand(f'/usr/bin/genfstab {flags} {self.target}')).decode())
|
||||
fstab_fh.write(fstab.decode())
|
||||
|
||||
if not os.path.isfile(f'{self.target}/etc/fstab'):
|
||||
raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}')
|
||||
raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n Error: {fstab}')
|
||||
|
||||
for plugin in plugins.values():
|
||||
if hasattr(plugin, 'on_genfstab'):
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ def list_mirrors(sort_order :List[str] = ["https", "http"]) -> Dict[str, Any]:
|
|||
try:
|
||||
response = urllib.request.urlopen(url)
|
||||
except urllib.error.URLError as err:
|
||||
log(f'Could not fetch an active mirror-list: {err}', level=logging.WARNING, fg="yellow")
|
||||
log(f'Could not fetch an active mirror-list: {err}', level=logging.WARNING, fg="orange")
|
||||
return regions
|
||||
|
||||
mirrorlist = response.read()
|
||||
|
|
|
|||
Loading…
Reference in New Issue