Provisions & event handlers
provision {} scripts run on vmlab up (failure is fatal); on "event" {} handlers react to lifecycle events (failure is logged).
Provision scripts are declared inside the vm {}/container {} they configure and run on vmlab up in declaration order; event handlers are lab-level and react to lifecycle events. Both are wscript files — see the provision block and the event handler block for the declarations.
Provision failures fail vmlab up; handler failures are logged, never fatal. A machine's steps gate depends_on on it: dependents wait for its provisions and playbooks to finish. Inside the script, lab.this_vm() is the owning VM and lab.vm("name") reaches any other machine, so a script that orchestrates several guests is declared on whichever one should gate it. See the event list for every event name.
§ 1Examples
§ 1.1A crash event handler
fn handle(event, lab): screenshot the crashed VM. Failures here are logged, never fatal.
use vmlab
lab.log
let Ok = lab.vm else
match vm.screenshot Ok => lab.log,
Err => lab.log,
}
}