Sledgehammer HooksΒΆ
- /updates/$nodename/$state-pre
- /updates/$state-pre
- /updates/$state-post
- /updates/$nodename/$state-post
$nodename = the name of the node according to Chef.
script | have been split into /updates/control_lib.sh, and control.sh has been | refactored to account for these changes. If your hooks are written in | bash, they can source /updates/control_lib.sh to pull in the following | functions:
- get_stateget_state will pull some information about from thechef-server, and store it in the local environment. Specifically,it will set the following environment variables:BMC_ROUTER = the gateway IP address of the BMC network, if any.BMC_ADDRESS = the IP address of the BMC for , if any.BMC_NETMASK = the netmask in dotted quad format of the BMC
network, | if any. | CROWBAR_STATE = the current Crowbar state that the node is in. | HOSTNAME = the hostname of the system according to the Chef server. | ALLOCATED = whether or not has been allocated
- post_statepost_state will attempt to transition to . Ifsuccessful, it will then update the same environment data that
get_state does.
- reboot_systemThis will cleanly reboot the node. You should use it instead ofreboot to ensure that all the logs are flushed and that the NFSshares get umounted.
- wait_for_allocatedThis function will spin until has been allocated by Crowbar.
- wait_for_crowbar_stateIf is not passed, this function will wait untiltransitions to a state other than the one it is currently at. Ifis passed, this function will wait until transitionsinto
- hook_has_run
If the current hook has already run for the current -pre or -post state, hook_has_run will return 0. Otherwise, return 1. This function works by creating state tracking files in /install-logs/. To facilitate this function, control.sh exports the following environment variables to the hooks:
HOOKNAME = the name of the hook without any path components.
HOOKSTATE = the -pre or -post state that the hook is running in.
Hook Exit Status