craft_parts.state_manager.states module

Helpers and definitions for lifecycle states.

craft_parts.state_manager.states.get_overlay_migration_state_path(state_dir, step)[source]

Return the path to the overlay migration state file for the given step.

Parameters:
  • state_dir (Path) –

  • step (Step) –

Return type:

Path

craft_parts.state_manager.states.get_step_state_path(part, step)[source]

Return the path to the state file for the given part and step.

Parameters:
Return type:

Path

craft_parts.state_manager.states.load_overlay_migration_state(state_dir, step)[source]

Retrieve the overlay migration state for the given step.

Parameters:
  • state_dir (Path) – The path to the directory containing migration state files.

  • step (Step) – The step corresponding to the migration state to load.

Return type:

Optional[MigrationState]

craft_parts.state_manager.states.load_step_state(part, step)[source]

Retrieve the persistent state for the given part and step.

Parameters:
  • part (Part) – The part corresponding to the state to load.

  • step (Step) – The step corresponding to the state to load.

Return type:

Optional[StepState]

Returns:

The step state.

Raises:

RuntimeError – If step is invalid.

craft_parts.state_manager.states.remove(part, step)[source]

Remove the persistent state file for the given part and step.

Parameters:
  • part (Part) – The part whose state is to be removed.

  • step (Step) – The step whose state is to be removed.

Return type:

None