osbuild-dev: use sys.exit
For consistency with the rest of the codebase, switch `osbuild-dev` over to use `sys.exit` instead of `SystemExit`.
This commit is contained in:
parent
b9876690f6
commit
a7b75bea3b
1 changed files with 5 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Any, Iterator, Optional
|
from typing import Any, Iterator, Optional
|
||||||
|
|
||||||
|
|
@ -53,10 +54,10 @@ def detect_and_parse_inputs(inputs) -> Iterator[str]:
|
||||||
yield value["id"]
|
yield value["id"]
|
||||||
else:
|
else:
|
||||||
con.print("[bold][red]Could not understand inputs format[/red][/bold]")
|
con.print("[bold][red]Could not understand inputs format[/red][/bold]")
|
||||||
raise SystemExit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
con.print("[bold][red]Could not understand inputs format[/red][/bold]")
|
con.print("[bold][red]Could not understand inputs format[/red][/bold]")
|
||||||
raise SystemExit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def json_as_terminal_tree(tree: Optional[Tree], data: Any, name: str) -> Tree:
|
def json_as_terminal_tree(tree: Optional[Tree], data: Any, name: str) -> Tree:
|
||||||
|
|
@ -148,7 +149,7 @@ class Manifest:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
con.print(f"[bold][red]Could not open file {path!r}[/red][/bold]")
|
con.print(f"[bold][red]Could not open file {path!r}[/red][/bold]")
|
||||||
raise SystemExit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# We deal with this possibly being a 'wrapped' manifest, one produced
|
# We deal with this possibly being a 'wrapped' manifest, one produced
|
||||||
# by `osbuild-composer`.
|
# by `osbuild-composer`.
|
||||||
|
|
@ -157,7 +158,7 @@ class Manifest:
|
||||||
|
|
||||||
if data.get("version") != "2":
|
if data.get("version") != "2":
|
||||||
con.print(f"[bold][red]Could not parse file {path!r}, wrong manifest version.[/red][/bold]")
|
con.print(f"[bold][red]Could not parse file {path!r}, wrong manifest version.[/red][/bold]")
|
||||||
raise SystemExit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return cls(os.path.basename(path), data)
|
return cls(os.path.basename(path), data)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue