Skip to main content

apply_with_phases

Function apply_with_phases 

Source
pub fn apply_with_phases(
    target: &Target,
    content: &[u8],
    expected_sha: &str,
    state_dir: &Path,
) -> (Result<Applied, String>, Phases)
Expand description

apply, also returning the phases that completed, so a node can report written, validated, reloaded and checked separately instead of one verdict.

Order: the new bytes are written beside the target; a validate command that contains {file} runs against that temporary file and the target is replaced only if it passes (the live file is never invalid); a validate without {file} runs against the file in place, as before. Then reload, then check (a command, or an http:// URL that must answer 2xx). A failing check puts the previous file back and reloads again, because the service is now running the new configuration.