38 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
8bdb73df9a
snapshot: Use privileged decorator for actions
Tests:

- DONE: Functional tests work
- DONE: Initial setup work on btrfs filesystem
- Not tested: Upgrading from older versions
- DONE: After backup is restored for snapshot app, snapper daemon is reloaded
- DONE: All configuration values are updated as expected
  - DONE: Values show up correctly in app page
  - DONE: Configuration files contain the proper values
- DONE: New snapshot can be created, gets listed in the snapshots list
- DONE: Enabling/disabling apt snapshotting works
  - DONE: Configuration file is updated
  - DONE: App page shows the correct value
- DONE: Deleting snapshots works, snapshot is removed from the list
- FAIL: Rolling back snapshots works (#2144)

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:13 -04:00
Sunil Mohan Adapa
9b6774f279
snapshot: Use AppView for app page
Tests:

- Enable/disable button is not shown.

- Diagnostics menu item is shown and works.

- Both Configure and manage snapshots tabs are shown.

- Changing configuration works, updated configuration is shown.

- Deleting some snapshots works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-29 08:29:11 -04:00
Sunil Mohan Adapa
900c0d30b9
*: Drop module level app property
module.app property usage is greatly reduced because setup() and force_upgrade()
method are now part of App class instead of at the module level. Remove the
remaining minor cases of usage and drop the property altogether.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:29 -04:00
Sunil Mohan Adapa
74214c18ae
*: Use Django gettext functions instead of ugettext
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.

- ugettext is already a simple alias of gettext. So, no regressions are
expected.

Tests:

- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.

- Using Django 3.2 there are no warnings related to removal of ugettext
functions.

- Ran regular unit tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:16 -04:00
Fioddor Superconcentrado
5f6add64bd
snapshots: Translate snapshot types (field description)
Helps: #1938

BTW, columns centered.

Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-11-25 11:25:13 -05:00
Sunil Mohan Adapa
20f2ff9370
snapshot: Fix issues with restore and delete
- Avoid no-response error when deleting a snapshot. This is caused when disk is
full and delete operation tries to store data in session which is stored on
disk. The session update fails and there are no values to delete. This case in
not handled and return a None in view causing a 500 error. Use GET params
instead.

- Delete all functionality that is meant to speed up deleting snapshots has
regressed and is currently never used. Further, there are more types of
snapshots that can't be deleted that needs to be handled in delete all
functionality. Drop it for now.

- When snapper list is run the snapshot number can contain '-', '+' or '*'
suffixed to it. Currently only '*' is handled. This leads to failure in listing
the snapshots after a restore snapshot'. Fix this is properly parsing. Also it
is no longer needed to query 'btrfs' command to know the snapshot that will
used at next boot. '+' or '*' means that.

- Don't list snapshot number '0'. It is never listed to the user and it can
never be deleted. It represents the current system.

- Properly implement checking for default and active snapshots. Don't let delete
operation on either of them.

- Fix regression with disabling the delete button when there are no snapshots
that can be deleted.

Tests performed:

- Before any snapshot is restored, the labels 'will be used at next boot' and
'in use' are not shown. Snapshot with number 0 is not shown.

- Immediately after restoring a snapshot, the 'will be used at next boot' label
will shown up on snapshot that is going to boot next.

- After rebooting after restore, the snapshot that has been restored will show
'will be used at next boot' and 'in use' labels. Restoring another snapshot will
move the 'will be used at next boot' label to the new restore snapshot but keep
the 'in use' label on the current snapshot until next reboot. Snapshot with
number 0 is not shown.

- Delete check boxes are not shown against the 'in use' and 'will be used at
next boot' snapshots. Entering their values manually in the URL in the delete
screen will lead them to be ignored.

- Select multiple snapshots and click delete. The details appear properly in the
confirmation window. Deleting will delete the snapshots.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-05-11 21:44:39 -04:00
James Valleroy
b1780f5e09
snapshot: Fix title
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-05-04 15:20:20 -07:00
Sunil Mohan Adapa
9368504da5
*.py: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:38:55 +02:00
Sunil Mohan Adapa
b576a77c3d
app: Refactor all apps to use the Info component
- Remove the need to pass all the individual information elements to the AppView
  separately. This eliminates many issues with elements that were mistakenly not
  sent to AppView. Also reduces a lot of code duplication.

- Create App classes for power and sso for consistency.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-16 18:22:01 -05:00
Alice Kile
eb83e00011
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-07 13:08:35 -05:00
Sunil Mohan Adapa
b3af80b15c
snapshot: Use app.html instead of app-subsubmenu.html
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-10-05 13:26:19 -04:00
Nikolas Nyby
5439084c84
Add flake8 to gitlib-ci - closes #58
And fix the rest of the flake8 errors.

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-07-25 11:07:06 -07:00
Joseph Nuthalapati
b0ef84f54a
snapshot: Handle "Config in use" error
Fixes #1132

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-09 19:06:28 -08:00
Joseph Nuthalapati
3d68f38738
snapshots: Handle installation on non-btrfs filesystems
Fixes #1147

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 15:13:04 -08:00
Sunil Mohan Adapa
1ec5b213ad
snapshot: Minor styling fixes
- Avoid use of _ in functional steps.

- flake8 fixes.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 14:00:26 -08:00
Joseph Nuthalapati
f68070c758
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
2019-01-08 13:59:15 -08:00
Joseph Nuthalapati
8ba0bda869
snapshot: Fix snapshots filling up the disk
- Snapper's cleanup algorithms don't apply limits unless they are specified in
the form of ranges. Changed all limit values in the configuration to ranges.
- Also, all MIN_AGE values have been set to 0 to avoid the disk space filling up
in case of a large number of snapshots generated in a very short amount of time.
- FREE_LIMIT has been increased to 30% from the default 20% since backup
archives also take up disk space on the root partition.

Fixes #1435

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-01-08 13:57:46 -08:00
Joseph Nuthalapati
7ee3c96abc
snapshots: Place the subsubmenu below the description
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-12-03 18:54:29 -05:00
Prachi Srivastava
1ab4815e8a
Adds toggle to select all for deletion
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-29 20:05:40 -05:00
Prachi Srivastava
5ec14f7c97
Changes delete all to delete selected in snapshot
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-29 20:05:35 -05:00
James Valleroy
04d5f12ae0
snapshot: Format code with yapf
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2018-04-09 18:51:11 -04:00
Shubham Agarwal
0b3880a4cf
snapper: enable/diable apt snapshots
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-04-09 18:43:00 -04:00
Joseph Nuthalapati
8416c0831d
snapshots: Fix for permissions issue when updating configuration
- Change `configure` command to `set-config` for consistency with `get-config`
- Run `set-config` as superuser

Fixes freedombox-team/plinth#1290

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-04-09 18:38:02 -04:00
Joseph Nuthalapati
a61046d7d0
snapshots: Move manual page link to the index page
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-04-08 10:57:34 -04:00
Joseph Nuthalapati
4064d6e231
manual: Link to manual from each service
Closes #930

- Make targets to download wiki pages of each service

- Add post-processor script for DocBook file processing

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-03-22 19:49:14 -04:00
Joseph Nuthalapati
9ab0e13ab9
snapshots: Refactoring and indentation changes
- Made updating snapshot configuration more efficient by running a single
  snapper command instead of one per configuration.
- Set default configuration for NUMBER_LIMIT only once at the time of
  installation. Snapshot version has been incremented to support this.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-03-09 13:42:54 +05:30
Shubham Agarwal
7ff2196d04
snapshots: Add submenu section in UI
Signed-off-by: Shubham Agarwal <shubhama@thoughtworks.com>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-03-09 13:41:57 +05:30
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Joseph Nuthalapati
3e5057e8cd
snapshots: Refactoring and text changes
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-02-12 17:44:16 +05:30
Aakanksha Saini
ace8abe34a
Snapper: Modify configurations to reduce disk usage
Signed-off-by: Aakanksha Saini <aakanksa@thoughtworks.com>
Signed-off-by: Shubham Agarwal <shubhama@thoughtworks.com>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-02-12 17:43:06 +05:30
Sunil Mohan Adapa
074ab4a736
snapshot: Enable Delete All only with non-default snapshots
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2018-02-12 16:40:48 +05:30
Joseph Nuthalapati
202d0bf5c7
snapshots: Minor refactoring
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-12-18 12:23:58 +05:30
hanisha
76ffad7955
Option to enable/disble automatic timeline snapshots
Signed-off-by: Hanisha P<hanishap@thoughtworks.com>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-12-18 12:21:01 +05:30
Joseph Nuthalapati
3e5dcfcbf5
snapshots: Button to delete all snapshots
- closes #1144

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-12-14 10:04:07 -05:00
Sunil Mohan Adapa
b8adb19e8b
Fix some Django deprecations
- Use simple_tag() instead of assignment_tag().  Assignments with simple_tag()
  works just like before.

- When loading urls for application, specify application name during inclusion.

- Use the reverse() method from django.urls which as moved from
  django.core.urlresolvers.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2017-10-04 18:32:41 -04:00
Prachi
c8eb714562
Separate out the short description and app name
Signed-off-by: Prachi <prachi@swecha.net>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-08-21 11:17:08 +05:30
Sunil Mohan Adapa
d615709b8a
snapshot: Improved messages and minor refactoring
- Make the default snapshot detection slightly more robust and refactor.

- Expand description to explain automatic snapshotting, etc.

- Show description even after setup.

- Show default snapshot as a bootstrap label.

- Message explaing how rollback can be undone.

- Minor updates to delete/rollback confirmation messages.

- Minor style refactoring
2016-08-08 22:21:31 +05:30
James Valleroy
5e18a648e1
snapshot: New module for disk snapshots
- Create and list filesystem snapshots. Hide "current" snapshot.

- Allow deleting snapshots, except for default subvolume.

- Allow rollback to a snapshot.
2016-08-08 22:21:21 +05:30