snapshot: Fix showing unsupported message on non-btrfs filesystems

This is a regression from commit 9b6774f279e2c8af588609c2413aa9804fd48cfa. When
change the view to use AppView, the condition to check for non-btrfs filesystems
and show an unsupported message instead of the actual view was accidentally
removed. Restore the check and show a different view when on non-btrfs
filesystems.

Fixes: #2268.

Tests:

- On non-btrfs filesystem, snapshots view is shown as expected.

- On ext4 filesystem, a message that snapshots are not supported is shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-12-15 15:15:23 -08:00 committed by James Valleroy
parent 740609c339
commit bcb0823e7c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -58,6 +58,13 @@ class SnapshotAppView(AppView):
template_name = 'snapshot.html'
form_class = SnapshotForm
def dispatch(self, request, *args, **kwargs):
"""If snapshots are not supported, use a different view."""
if not snapshot_module.is_supported():
return not_supported_view(request)
return super().dispatch(request, *args, **kwargs)
def get_initial(self):
"""Return the values to fill in the form."""
initial = super().get_initial()