craft_parts.filesystem_mounts module¶
FilesystemMounts models.
- class craft_parts.filesystem_mounts.FilesystemMount(root=PydanticUndefined, **data)[source]¶
Bases:
RootModel[Annotated[list[FilesystemMountItem], AfterValidator, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]]FilesystemMount defines the order in which devices should be mounted.
- Parameters:
root (
TypeVar(RootModelRootType))
- classmethod first_maps_to_slash(value)[source]¶
Make sure the first item in the list maps the ‘/’ mount.
- Parameters:
value (
list[FilesystemMountItem])- Return type:
list[FilesystemMountItem]
- marshal()[source]¶
Create a list containing the filesystem_mount data.
- Return type:
list[dict[str,Any]]- Returns:
The newly created list.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod unmarshal(data)[source]¶
Create and populate a new
FilesystemMountobject from list.The unmarshal method validates entries in the input list, populating the corresponding fields in the data object.
- Parameters:
data (
list[dict[str,Any]]) – The list to unmarshal.- Return type:
- Returns:
The newly created object.
- Raises:
TypeError – If data is not a list.
pydantic.ValidationError – If the data fails validation.
- classmethod validate_entries_order(value)[source]¶
Check entries are ordered in increasing depth.
- Parameters:
value (
list[FilesystemMountItem])- Return type:
list[FilesystemMountItem]
- class craft_parts.filesystem_mounts.FilesystemMountItem(**data)[source]¶
Bases:
BaseModelFilesystemMountItem maps a mountpoint to a device.
- Parameters:
data (
Any)
-
device:
str¶
- marshal()[source]¶
Create a dictionary containing the filesystem_mount item data.
- Return type:
dict[str,Any]- Returns:
The newly created dictionary.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
mount:
str¶
- classmethod strip_parenthesis(value)[source]¶
Strip parenthesis until a better integration with partitions.
- Parameters:
value (
str)- Return type:
str
- classmethod unmarshal(data)[source]¶
Create and populate a new
FilesystemMountItemobject from dictionary data.The unmarshal method validates entries in the input dictionary, populating the corresponding fields in the data object.
- Parameters:
data (
dict[str,Any]) – The dictionary data to unmarshal.- Return type:
- Returns:
The newly created object.
- Raises:
TypeError – If data is not a dictionary.
- class craft_parts.filesystem_mounts.FilesystemMounts(root=PydanticUndefined, **data)[source]¶
Bases:
RootModel[Annotated[dict[Literal['default'], FilesystemMount], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1), MaxLen(max_length=1)])]]FilesystemMounts defines list of FilesystemMount.
- Parameters:
root (
TypeVar(RootModelRootType))
- get(key, default=None)[source]¶
Return a specific item of the underlying dict.
- Parameters:
key (
Literal['default'])default (
FilesystemMount|None)
- Return type:
FilesystemMount|None
- items()[source]¶
Return items of the underlying dict.
- Return type:
Iterable[tuple[Literal['default'],FilesystemMount]]
- marshal()[source]¶
Create a dictionary containing the filesystem_mounts data.
- Return type:
dict[str,Any]- Returns:
The newly created dictionary.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod unmarshal(data)[source]¶
Create and populate a new
FilesystemMountsobject from dictionary data.The unmarshal method validates entries in the input dictionary, populating the corresponding fields in the data object.
- Parameters:
data (
dict[str,Any]) – The dictionary data to unmarshal.- Return type:
- Returns:
The newly created object.
- Raises:
TypeError – If data is not a dictionary.
- craft_parts.filesystem_mounts.validate_filesystem_mount(data)[source]¶
Validate a filesystem_mount.
- Parameters:
data (
list[dict[str,Any]]) – The filesystem mount data to validate.- Raises:
ValueError if the filesystem mount is not valid.
- Return type:
None
- craft_parts.filesystem_mounts.validate_filesystem_mounts(filesystem_mounts)[source]¶
Validate the filesystems section.
If filesystems are defined then both partition and overlay features must be enabled. A filesystem_mounts dict must only have a single “default” entry. The first entry in default must map the ‘/’ mount.
- Raises:
FilesystemMountError if the filesystem mounts are not valid.
- Parameters:
filesystem_mounts (
dict[str,Any] |None)- Return type:
None