diff --git a/actions/snapshot b/actions/snapshot index 35cc561c0..afd140f5a 100755 --- a/actions/snapshot +++ b/actions/snapshot @@ -55,7 +55,8 @@ def parse_arguments(): subparser = subparsers.add_parser('rollback', help='Rollback to snapshot') subparser.add_argument('number', help='Number of snapshot to rollback to') - subparser = subparsers.add_parser('disable-apt-snapshot', help='enable/disable apt snapshots') + subparser = subparsers.add_parser('disable-apt-snapshot', + help='enable/disable apt snapshots') subparser.add_argument('state') subparsers.required = True @@ -161,10 +162,9 @@ def _get_default_snapshot(): def subcommand_disable_apt_snapshot(arguments): """Set flag to Enable/Disable apt software snapshots in config files""" - """Initialize Augeas.""" - aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + - augeas.Augeas.NO_MODL_AUTOLOAD) + aug = augeas.Augeas( + flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD) aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns') aug.set('/augeas/load/Shellvars/incl[last() + 1]', DEFAULT_FILE) aug.load() diff --git a/plinth/modules/snapshot/__init__.py b/plinth/modules/snapshot/__init__.py index b05b58521..deb8cdc05 100644 --- a/plinth/modules/snapshot/__init__.py +++ b/plinth/modules/snapshot/__init__.py @@ -70,8 +70,8 @@ def setup(helper, old_version=None): def load_augeas(): """Initialize Augeas.""" - aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + - augeas.Augeas.NO_MODL_AUTOLOAD) + aug = augeas.Augeas( + flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD) # shell-script config file lens aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns') diff --git a/plinth/modules/snapshot/forms.py b/plinth/modules/snapshot/forms.py index 1b9dd8b2b..c3657129f 100644 --- a/plinth/modules/snapshot/forms.py +++ b/plinth/modules/snapshot/forms.py @@ -24,16 +24,15 @@ 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).'), + label=_('Timeline Snapshots'), help_text=_( + 'Enable or disable timeline snapshots ' + '(hourly, daily, monthly and yearly).'), choices=[('yes', 'Enabled'), ('no', 'Disabled')]) 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')]) + label=_('Software Installation Snapshots'), help_text=_( + 'Enable or disable snapshots before and after software ' + 'installation'), choices=[('yes', 'Enabled'), ('no', 'Disabled')]) hourly_limit = forms.IntegerField( label=_('Hourly Snapshots Limit'), min_value=0, diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py index 2baf845dc..7f3df7da8 100644 --- a/plinth/modules/snapshot/views.py +++ b/plinth/modules/snapshot/views.py @@ -55,14 +55,13 @@ def index(request): else: form = SnapshotForm(initial=status) - return TemplateResponse( - request, 'snapshot.html', { - 'title': snapshot_module.name, - 'description': snapshot_module.description, - 'manual_page': snapshot_module.manual_page, - 'subsubmenu': subsubmenu, - 'form': form - }) + return TemplateResponse(request, 'snapshot.html', { + 'title': snapshot_module.name, + 'description': snapshot_module.description, + 'manual_page': snapshot_module.manual_page, + 'subsubmenu': subsubmenu, + 'form': form + }) def manage(request): @@ -77,12 +76,11 @@ def manage(request): has_deletable_snapshots = any( [snapshot for snapshot in snapshots[1:] if not snapshot['is_default']]) - return TemplateResponse( - request, 'snapshot_manage.html', { - 'snapshots': snapshots, - 'has_deletable_snapshots': has_deletable_snapshots, - 'subsubmenu': subsubmenu, - }) + return TemplateResponse(request, 'snapshot_manage.html', { + 'snapshots': snapshots, + 'has_deletable_snapshots': has_deletable_snapshots, + 'subsubmenu': subsubmenu, + }) def update_configuration(request, old_status, new_status): @@ -108,7 +106,8 @@ def update_configuration(request, old_status, new_status): ('number_min_age', 'NUMBER_MIN_AGE={}'), ])) - if old_status['enable_software_snapshots'] != new_status['enable_software_snapshots']: + if old_status['enable_software_snapshots'] != new_status[ + 'enable_software_snapshots']: if new_status['enable_software_snapshots'] == 'yes': actions.superuser_run('snapshot', ['disable-apt-snapshot', 'no']) else: @@ -130,8 +129,7 @@ def delete(request, number): if request.method == 'POST': actions.superuser_run('snapshot', ['delete', number]) messages.success( - request, - _('Deleted snapshot #{number}.').format(number=number)) + request, _('Deleted snapshot #{number}.').format(number=number)) return redirect(reverse('snapshot:manage')) output = actions.superuser_run('snapshot', ['list'])