yera.config.replacement

Safely replace unusable global Yera configuration.

Symbols

class ConfigReplacement — Result of replacing unusable global Yera configuration.
def replace_invalid_yera_toml — Back up and replace unusable global Yera configuration.

ConfigReplacement

Result of replacing unusable global Yera configuration.

Attributes

path
type: Path

Global configuration path replaced by the operation.

backup_path
type: Path

Path containing the original configuration.

replace_invalid_yera_toml

replace_invalid_yera_toml() → ConfigReplacement

Back up and replace unusable global Yera configuration.

Re-inspects the global configuration immediately before replacement to avoid acting on stale setup state. Only malformed TOML or schema-invalid Yera configuration can be replaced.

The original file is copied into a backups directory beside yera.toml. The active configuration is then atomically replaced by an empty file, which is valid initial Yera configuration.

Returns

type: ConfigReplacement

Paths to the replaced global configuration and its preserved backup.

Raises

ConfigReplacementError

If the configuration is missing or valid.

OSError

If the backup or atomic replacement cannot be completed.