mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
backups: Use ISO timestamp for auto-naming archives
Closes: #1603. - This introduces seconds and timezone in the name of the archive. When seconds are not used in the name, taking backups too quickly on after the other fails as the names clash. Tests: - Taking a backup works and creates the name in the expected ISO time format. - Changing the timezone and restarting service creates timestamps in that timezone. Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
91270331cc
commit
fd1d13f9af
@ -130,8 +130,11 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
|
||||
if repository.flags.get('mountable'):
|
||||
repository.mount()
|
||||
|
||||
name = form.cleaned_data['name'] or datetime.now().strftime(
|
||||
'%Y-%m-%d:%H:%M')
|
||||
name = form.cleaned_data['name']
|
||||
if not name:
|
||||
name = datetime.now().astimezone().replace(
|
||||
microsecond=0).isoformat()
|
||||
|
||||
selected_apps = form.cleaned_data['selected_apps']
|
||||
repository.create_archive(name, selected_apps)
|
||||
return super().form_valid(form)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user