move snapd enums back to snapdapi now they are no longer part of the subiquity API

This commit is contained in:
Michael Hudson-Doyle 2023-03-23 17:07:30 +13:00
parent 26f3a24512
commit a9c6922a9e
3 changed files with 36 additions and 36 deletions

View File

@ -26,8 +26,6 @@ import attr
from subiquitycore.models.network import NetDevInfo
from subiquity.common.serialize import named_field
class ErrorReportState(enum.Enum):
INCOMPLETE = enum.auto()
@ -339,36 +337,6 @@ class GuidedChoice:
password: Optional[str] = attr.ib(default=None, repr=False)
class StorageEncryptionSupport(enum.Enum):
DISABLED = 'disabled'
AVAILABLE = 'available'
UNAVAILABLE = 'unavailable'
DEFECTIVE = 'defective'
class StorageSafety(enum.Enum):
UNSET = 'unset'
ENCRYPTED = 'encrypted'
PREFER_ENCRYPTED = 'prefer-encrypted'
PREFER_UNENCRYPTED = 'prefer-unencrypted'
class EncryptionType(enum.Enum):
NONE = ''
CRYPTSETUP = 'cryptsetup'
DEVICE_SETUP_HOOK = 'device-setup-hook'
@attr.s(auto_attribs=True)
class StorageEncryption:
support: StorageEncryptionSupport
storage_safety: StorageSafety = named_field('storage-safety')
encryption_type: EncryptionType = named_field(
'encryption-type', default=EncryptionType.NONE)
unavailable_reason: str = named_field(
'unavailable-reason', default='')
@attr.s(auto_attribs=True)
class GuidedStorageResponse:
status: ProbeStatus

View File

@ -70,11 +70,8 @@ from subiquity.common.types import (
ModifyPartitionV2,
ProbeStatus,
ReformatDisk,
StorageEncryption,
StorageEncryptionSupport,
StorageResponse,
StorageResponseV2,
StorageSafety,
)
from subiquity.models.filesystem import (
ActionRenderMode,
@ -91,6 +88,11 @@ from subiquity.server.controller import (
)
from subiquity.server import snapdapi
from subiquity.server.mounter import Mounter
from subiquity.server.snapdapi import (
StorageEncryption,
StorageEncryptionSupport,
StorageSafety,
)
from subiquity.server.types import InstallerChannels

View File

@ -23,7 +23,7 @@ from typing import Dict, List, Optional
from subiquity.common.api.client import make_client
from subiquity.common.api.defs import api, path_parameter, Payload
from subiquity.common.serialize import named_field, Serializer
from subiquity.common.types import Change, StorageEncryption, TaskStatus
from subiquity.common.types import Change, TaskStatus
import attr
@ -178,6 +178,36 @@ class OnVolume(Volume):
return cls(**kw)
class StorageEncryptionSupport(enum.Enum):
DISABLED = 'disabled'
AVAILABLE = 'available'
UNAVAILABLE = 'unavailable'
DEFECTIVE = 'defective'
class StorageSafety(enum.Enum):
UNSET = 'unset'
ENCRYPTED = 'encrypted'
PREFER_ENCRYPTED = 'prefer-encrypted'
PREFER_UNENCRYPTED = 'prefer-unencrypted'
class EncryptionType(enum.Enum):
NONE = ''
CRYPTSETUP = 'cryptsetup'
DEVICE_SETUP_HOOK = 'device-setup-hook'
@attr.s(auto_attribs=True)
class StorageEncryption:
support: StorageEncryptionSupport
storage_safety: StorageSafety = named_field('storage-safety')
encryption_type: EncryptionType = named_field(
'encryption-type', default=EncryptionType.NONE)
unavailable_reason: str = named_field(
'unavailable-reason', default='')
@attr.s(auto_attribs=True)
class SystemDetails:
current: bool = False