mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
snapshot: ui: Remove NUMBER_MIN_AGE setting and add FREE_LIMIT
The free space limit value is allowed to a maximum of 60%, since setting the it to a value higher than possible will effectively disable snapshotting. Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org
This commit is contained in:
parent
8ba0bda869
commit
f68070c758
@ -254,7 +254,7 @@ def subcommand_get_config(_):
|
||||
def subcommand_migrate(_):
|
||||
"""Migrate existing user configuration for snapshots
|
||||
to the new configuration format.
|
||||
Add in version 4 of the snapshots module.
|
||||
Added in version 4 of the snapshots module.
|
||||
This command will not check or perform first setup steps.
|
||||
"""
|
||||
config = _get_config()
|
||||
|
||||
@ -117,8 +117,8 @@ def get_configuration():
|
||||
get_max_from_range('TIMELINE_LIMIT_MONTHLY'),
|
||||
'yearly_limit':
|
||||
get_max_from_range('TIMELINE_LIMIT_YEARLY'),
|
||||
'number_min_age':
|
||||
round(int(output['NUMBER_MIN_AGE']) / 86400),
|
||||
'free_space':
|
||||
output['FREE_LIMIT'],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,17 +23,23 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class SnapshotForm(forms.Form):
|
||||
enable_timeline_snapshots = forms.ChoiceField(
|
||||
label=_('Timeline Snapshots'), help_text=_(
|
||||
'Enable or disable timeline snapshots '
|
||||
'(hourly, daily, monthly and yearly).'),
|
||||
choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
free_space = forms.ChoiceField(
|
||||
label=_('Free Space'),
|
||||
help_text=_('Maintain this percentage of free space on the disk. '
|
||||
'The default value is 30%.'),
|
||||
choices=[(i / 100, i) for i in range(10, 70, 10)])
|
||||
|
||||
enable_software_snapshots = forms.ChoiceField(
|
||||
label=_('Software Installation Snapshots'), help_text=_(
|
||||
'Enable or disable snapshots before and after software '
|
||||
'installation'), choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
|
||||
enable_timeline_snapshots = forms.ChoiceField(
|
||||
label=_('Timeline Snapshots'),
|
||||
help_text=_('Enable or disable timeline snapshots '
|
||||
'(hourly, daily, monthly and yearly).'),
|
||||
choices=[('yes', 'Enabled'), ('no', 'Disabled')])
|
||||
|
||||
hourly_limit = forms.IntegerField(
|
||||
label=_('Hourly Snapshots Limit'), min_value=0,
|
||||
help_text=_('Keep a maximum of this many hourly snapshots.'))
|
||||
@ -51,12 +57,6 @@ class SnapshotForm(forms.Form):
|
||||
help_text=_('Keep a maximum of this many monthly snapshots.'))
|
||||
|
||||
yearly_limit = forms.IntegerField(
|
||||
label=_('Yearly Snapshots Limit'), min_value=0, help_text=_(
|
||||
'Keep a maximum of this many yearly snapshots. '
|
||||
'The default is 0 (disabled).'))
|
||||
|
||||
number_min_age = forms.IntegerField(
|
||||
label=_('Delete Software Snapshots older than (days)'), min_value=0,
|
||||
help_text=_(
|
||||
'Software snapshots older than this will be deleted. '
|
||||
'This does not limit the number of software snapshots created.'))
|
||||
label=_('Yearly Snapshots Limit'), min_value=0,
|
||||
help_text=_('Keep a maximum of this many yearly snapshots. '
|
||||
'The default value is 0 (disabled).'))
|
||||
|
||||
@ -105,8 +105,6 @@ def update_configuration(request, old_status, new_status):
|
||||
else:
|
||||
return None
|
||||
|
||||
new_status['number_min_age'] = int(new_status['number_min_age']) * 86400
|
||||
|
||||
config = filter(
|
||||
None,
|
||||
map(make_config, [
|
||||
@ -116,7 +114,7 @@ def update_configuration(request, old_status, new_status):
|
||||
('weekly_limit', 'TIMELINE_LIMIT_WEEKLY={}'),
|
||||
('monthly_limit', 'TIMELINE_LIMIT_MONTHLY={}'),
|
||||
('yearly_limit', 'TIMELINE_LIMIT_YEARLY={}'),
|
||||
('number_min_age', 'NUMBER_MIN_AGE={}'),
|
||||
('free_space', 'FREE_LIMIT={}'),
|
||||
]))
|
||||
|
||||
if old_status['enable_software_snapshots'] != new_status['enable_software_snapshots']:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user