storage: Ignore errors resizing partition during initial setup

On Raspberry Pi 3B+ image, it was observed that resizing partition fails during
initial setup. Due to this, Apache, SSH and Plinth become unavailable. Since
resizing the partition is not a critical operation to perform to bring up
FreedomBox, it is safe it ignore the error. In these cases, the user will have
to the storage app and retry manually after bring prompted by low disk space
message.

Tests:

- Introduce deliberate error in expand partition operation. Modify code to
  always detect that partition can be expanded. Remove storage module from
  plinth_module table in plinth.sqlite3. Run plinth. Notice that storage setup
  is run but expanding partition fails. Even after expanding partition fails,
  storage module is fully setup. Plinth proceeds with starting web server and
  storage module is found in the plinth_module table of plinth.sqlite3.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-01-01 03:02:11 -08:00 committed by James Valleroy
parent cfe014a3f4
commit 0a48175249
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -27,7 +27,7 @@ from plinth import actions
from plinth import app as app_module
from plinth import cfg, menu, utils
from plinth.daemon import Daemon
from plinth.errors import PlinthError
from plinth.errors import ActionError, PlinthError
from plinth.utils import format_lazy, import_from_gi
from .manifest import backup # noqa, pylint: disable=unused-import
@ -281,4 +281,7 @@ def setup(helper, old_version=None):
disks = get_disks()
root_device = get_root_device(disks)
if is_expandable(root_device):
expand_partition(root_device)
try:
expand_partition(root_device)
except ActionError:
pass