fix some bugs in editing and displaying swap partitions/devices

https://bugs.launchpad.net/subiquity/+bug/1828661
This commit is contained in:
Michael Hudson-Doyle 2019-05-13 09:34:27 +12:00
parent f9b9414de1
commit 96aafc668d
2 changed files with 21 additions and 15 deletions

View File

@ -385,14 +385,18 @@ class DeviceList(WidgetWrap):
component_name=cd.component_name, name=cd.name)
fs = obj.fs()
if fs is not None:
m = fs.mount()
if m:
return _(
"formatted as {fstype}, mounted at {path}").format(
fstype=fs.fstype, path=m.path)
else:
return _("formatted as {fstype}, not mounted").format(
if not self.parent.model.is_mounted_filesystem(fs.fstype):
return _("formatted as {fstype}").format(
fstype=fs.fstype)
else:
m = fs.mount()
if m:
return _(
"formatted as {fstype}, mounted at {path}").format(
fstype=fs.fstype, path=m.path)
else:
return _("formatted as {fstype}, not mounted").format(
fstype=fs.fstype)
else:
return _("unused")

View File

@ -259,11 +259,12 @@ class PartitionStretchy(Stretchy):
if fs is not None:
if partition.flag != "boot":
initial['fstype'] = fs.fstype
mount = fs.mount()
if mount is not None:
initial['mount'] = mount.path
else:
initial['mount'] = None
if self.model.is_mounted_filesystem(fs.fstype):
mount = fs.mount()
if mount is not None:
initial['mount'] = mount.path
else:
initial['mount'] = None
if isinstance(disk, LVM_VolGroup):
initial['name'] = partition.name
lvm_names.remove(partition.name)
@ -378,9 +379,10 @@ class FormatEntireStretchy(Stretchy):
fs = device.fs()
if fs is not None:
initial['fstype'] = fs.fstype
mount = fs.mount()
if mount is not None:
initial['mount'] = mount.path
if self.model.is_mounted_filesystem(fs.fstype):
mount = fs.mount()
if mount is not None:
initial['mount'] = mount.path
elif not isinstance(device, Disk):
initial['fstype'] = 'ext4'
self.form = PartitionForm(self.model, 0, initial, False, None)