management.util.startup_context

Context builder for startup strategies.

Classes

StartupContextBuilder

Builder for creating StartupContext objects.

Module Contents

class management.util.startup_context.StartupContextBuilder(output, current_version)[source]

Builder for creating StartupContext objects.

Parameters:
output[source]
current_version[source]
db_version: packaging.version.Version | None = None[source]
wizard_state: setup_wizard.SetupWizardState | None = None[source]
wizard_completed: bool = False[source]
storage_type: management.models.KeyStorageConfig.StorageType | None = None[source]
is_hsm: bool = False[source]
dek_accessible: bool = False[source]
has_kek: bool = False[source]
has_backup_encrypted_dek: bool = False[source]
with_db_version(db_version)[source]

Set the database version.

Parameters:

db_version (packaging.version.Version) – The version from the database.

Returns:

Self for method chaining.

Return type:

StartupContextBuilder

collect_wizard_state()[source]

Collect wizard state information.

Returns:

Self for method chaining.

Return type:

StartupContextBuilder

collect_storage_config()[source]

Collect storage configuration information.

Returns:

Self for method chaining.

Return type:

StartupContextBuilder

collect_dek_state()[source]

Collect DEK accessibility information.

Returns:

Self for method chaining.

Return type:

StartupContextBuilder

_check_kek_exists_on_hsm(token)[source]

Check if the KEK actually exists on the physical HSM.

This method verifies that the KEK is not just referenced in the database, but actually exists on the physical HSM by attempting to load it.

Parameters:

token (management.models.PKCS11Token) – The PKCS11Token to check.

Returns:

True if KEK exists on HSM, False otherwise.

Return type:

bool

build()[source]

Build the StartupContext object.

Returns:

The constructed StartupContext.

Return type:

management.util.startup_strategies.StartupContext

build_for_db_init()[source]

Build a minimal StartupContext for database initialization scenarios.

This is used when the database is not initialized or has no version, so we can’t query for wizard state, storage config, or DEK state.

Returns:

A minimal StartupContext with db_initialized=False.

Return type:

management.util.startup_strategies.StartupContext