osbuild-dev: properly exit and validate manifest
This commit is contained in:
parent
6ad906085c
commit
dce36ab420
1 changed files with 5 additions and 1 deletions
|
|
@ -148,13 +148,17 @@ class Manifest:
|
|||
data = json.load(f)
|
||||
except FileNotFoundError:
|
||||
con.print(f"[bold][red]Could not open file {path!r}[/red][/bold]")
|
||||
return 1
|
||||
raise SystemExit(1)
|
||||
|
||||
# We deal with this possibly being a 'wrapped' manifest, one produced
|
||||
# by `osbuild-composer`.
|
||||
if "manifest" in data:
|
||||
data = data["manifest"]
|
||||
|
||||
if data.get("version") != "2":
|
||||
con.print(f"[bold][red]Could not parse file {path!r}, wrong manifest version.[/red][/bold]")
|
||||
raise SystemExit(1)
|
||||
|
||||
return cls(os.path.basename(path), data)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue