mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
snapshot: Fix issue with snapshot rollbacks
Closes: #2144. - '--ambit' seems to a required argument if there is no default subvolume set on the filesystem. Add it to prevent error during rollback. - Description is not a required option for rollback (anymore?) and default descriptions for the two snapshots are more descriptive. Tests: - On a fresh vagrant machine, run snapshot rollback with the patch. It fails. With the patch, rollback succeeds. - The description created for the rollback is the default one 'rollback backup' and 'writable copy of #x'. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
d0ea67cde6
commit
0f484d7eaa
@ -251,7 +251,12 @@ def kill_daemon():
|
||||
@privileged
|
||||
def rollback(number: str):
|
||||
"""Rollback to snapshot."""
|
||||
command = [
|
||||
'snapper', 'rollback', '--description', 'created by rollback', number
|
||||
]
|
||||
# "ambit" is not very well documented by snapper. Default ambit is "auto"
|
||||
# which errors out if default subvolume is not yet set on the filesystem.
|
||||
# If set, then it acts as "transactional" ambit if the default snapshot is
|
||||
# readonly, otherwise it acts as "classic". The "classic" behavior is the
|
||||
# one described snapper(8) man page for rollback behavior. The classic
|
||||
# behavior when a snapshot number to rollback to is provided is the
|
||||
# behavior that we desire.
|
||||
command = ['snapper', '--ambit', 'classic', 'rollback', number]
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user