Development

This commit is contained in:
Matthew Grotke 2026-05-26 00:58:51 -04:00
parent 222f43feff
commit 3c7b13e98a
3 changed files with 21 additions and 6 deletions

View file

@ -404,6 +404,7 @@ def revert_snapshot_to_config(entry_uuid):
before=after, after=before,
description=f"Reverted: {snap.get('description', '')}",
cmd=snap.get('cmd', 'core apply'),
reverts=entry_uuid,
)
return msg or 'Reverted.', True
@ -421,7 +422,7 @@ def load_snapshot_for_uuid(entry_uuid):
def save_config_with_snapshot(new_config, path, key, operation, before, after,
description='', cmd='core apply', queue=True):
description='', cmd='core apply', queue=True, reverts=None):
"""
Write a .snapshots/{ts}-{uuid}.json file, save new_config to disk, and
optionally create a pending queue entry. Returns a flash message string.
@ -448,6 +449,7 @@ def save_config_with_snapshot(new_config, path, key, operation, before, after,
'before': before,
'after': after,
'depends_on': depends_on,
'reverts': reverts,
}
with open(os.path.join(SNAPSHOTS_DIR, f'{entry_ts}-{entry_uuid}.json'), 'w') as f:
json.dump(snapshot, f, indent=2)