Development
This commit is contained in:
parent
adcfe55c7c
commit
59d3d65d18
7 changed files with 146 additions and 75 deletions
|
|
@ -421,8 +421,10 @@ def save_config_with_snapshot(new_core, path, key, operation, before, after,
|
|||
description='', cmd='core apply', queue=True):
|
||||
"""
|
||||
Write a .snapshots/{ts}-{uuid}.json file, save new_core to disk, and
|
||||
optionally create a pending queue entry. Returns a flash message string
|
||||
when queue=True, otherwise None.
|
||||
optionally create a pending queue entry. Returns a flash message string.
|
||||
|
||||
queue=False: skips queueing and records the change directly in
|
||||
.dashboard-done so it appears in Change History without a pending step.
|
||||
"""
|
||||
entry_uuid = str(uuid.uuid4())
|
||||
entry_ts = int(datetime.now().timestamp())
|
||||
|
|
@ -450,7 +452,9 @@ def save_config_with_snapshot(new_core, path, key, operation, before, after,
|
|||
save_config(new_core)
|
||||
|
||||
if not queue:
|
||||
return None
|
||||
with open(DASHBOARD_DONE, 'a') as f:
|
||||
f.write(f'{entry_uuid} {entry_ts}\n')
|
||||
return 'Saved.'
|
||||
|
||||
if _apply_changes_immediately():
|
||||
with open(DASHBOARD_QUEUE, 'a') as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue