Skip to main content

hooks_block

Function hooks_block 

Source
pub fn hooks_block(
    port: u16,
    run: RunHookTimeout,
    build: BuildHookTimeout,
) -> Hooks
Expand description

The Hooks block with all six hooks enabled and both timeout families set.

All six because ready and validate are image-build hooks: the build calls them to decide whether the snapshot it just produced is usable, before any instance exists and therefore before any token has been delivered. Gating them on bootstrap state fails the build rather than the run, which is a confusing place to discover the mistake.

The two timeouts are separate types, so the 60x gap cannot be crossed by passing one number twice — see crate::hooks. ENABLED is ops::HookState::Enabled rather than a &str local, which is issue #24’s point about this function: the literal appeared six times with no constant naming either value, so a typo in one of the six was a ValidationException on a create call made after the artifact upload. It is now a compile error.