mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-09 10:39:11 +02:00
Reject invalid cookbook CLI state (#1531)
This commit is contained in:
parent
082e556975
commit
74a6b54e33
2 changed files with 32 additions and 0 deletions
|
|
@ -411,6 +411,8 @@ def cmd_state_set(args) -> None:
|
|||
obj = json.loads(data)
|
||||
except json.JSONDecodeError as e:
|
||||
fail(f"invalid JSON on stdin: {e}")
|
||||
if not isinstance(obj, dict):
|
||||
fail("invalid cookbook state: expected a JSON object")
|
||||
_STATE_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
# Backup the existing state — undo button if a bad pipe clobbers it.
|
||||
if _STATE_PATH.exists():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue