nfsops.configurations.context module

Context configuration model.

class nfsops.configurations.context.ContextConfiguration(*, type: Literal['context'] = 'context', context: nfsops.context_type.ContextType = None, root_template: str = None, path: pydantic.types.DirectoryPath = None)

Bases: nfsops.configurations.configuration.Configuration

Context configuration model.

context: nfsops.context_type.ContextType

Context type.

path: Optional[pydantic.types.DirectoryPath]

Volume path. Defaults to $HOME for subpath context, /var/nfs-shared otherwise.

root_template: Optional[str]

Path template for backup name reference in the root context.

type: Literal['context']

Configuration type.

classmethod validate_path(value: Optional[pydantic.types.DirectoryPath], values: Dict[str, Any]) Optional[pydantic.types.DirectoryPath]

Return the default volume path based on context if the value is “None”, original value otherwise.

Parameters
  • value (Optional[DirectoryPath]) – Directory path or None.

  • values (Dict[str, Any]) – Dictionary containing all parameter values.

Returns

Optional[DirectoryPath] – A default directory path or None.

classmethod validate_root_template(value: Optional[str], values: Dict[str, Any]) Optional[str]

Return the original value if the root template is available for root context, raise exception otherwise.

Parameters
  • value (Optional[str]) – Root template or None.

  • values (Dict[str, Any]) – Dictionary containing all parameter values.

Returns

Optional[str] – A root template string or None.

Raises

ValueError – Expected root template not available for root context.