filesystem: capability flags in a specific order
Show DIRECT first, list CORE_BOOT ones later. LP: #2033244
This commit is contained in:
parent
f440e6dd1f
commit
edde096540
|
@ -38,3 +38,6 @@ class TestCapabilities(unittest.TestCase):
|
|||
|
||||
def test_is_zfs(self):
|
||||
self.assertTrue(GuidedCapability.ZFS.is_zfs())
|
||||
|
||||
def test_order(self):
|
||||
self.assertLess(GuidedCapability.DIRECT, GuidedCapability.CORE_BOOT_ENCRYPTED)
|
||||
|
|
|
@ -340,6 +340,8 @@ class Disk:
|
|||
|
||||
|
||||
class GuidedCapability(enum.Enum):
|
||||
# The order listed here is the order they will be presented as options
|
||||
|
||||
MANUAL = enum.auto()
|
||||
DIRECT = enum.auto()
|
||||
LVM = enum.auto()
|
||||
|
@ -354,6 +356,9 @@ class GuidedCapability(enum.Enum):
|
|||
|
||||
DD = enum.auto()
|
||||
|
||||
def __lt__(self, other) -> bool:
|
||||
return self.value < other.value
|
||||
|
||||
def is_lvm(self) -> bool:
|
||||
return self in [GuidedCapability.LVM, GuidedCapability.LVM_LUKS]
|
||||
|
||||
|
|
|
@ -128,6 +128,8 @@ class CapabilityInfo:
|
|||
new_disallowed.append(disallowed_cap)
|
||||
seen_disallowed.add(disallowed_cap.capability)
|
||||
self.disallowed = new_disallowed
|
||||
self.allowed.sort()
|
||||
self.disallowed.sort()
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
@ -967,7 +969,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
continue
|
||||
if not info.is_core_boot_classic():
|
||||
classic_capabilities.update(info.capability_info.allowed)
|
||||
return sorted(classic_capabilities, key=lambda x: x.name)
|
||||
return sorted(classic_capabilities)
|
||||
|
||||
async def v2_guided_GET(self, wait: bool = False) -> GuidedStorageResponseV2:
|
||||
"""Acquire a list of possible guided storage configuration scenarios.
|
||||
|
|
|
@ -349,6 +349,7 @@ class TestFlow(TestAPI):
|
|||
|
||||
resp = await inst.get("/storage/v2/guided?wait=true")
|
||||
[reformat, manual] = resp["targets"]
|
||||
self.assertEqual("DIRECT", reformat["allowed"][0])
|
||||
await inst.post(
|
||||
"/storage/v2/guided",
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue