I want to run a simple check at the beginning of all of our chef-client runs to ensure that our nodes are bootstrapped with a chef environment. It is pretty simple and looks like this:
if node.environment() == "_default"
log "chef-environment-check" do
message "Chef environment must be set on all nodes. Please re-bootstrap your node including the --environment parameter."
level :fatal
end
end
But when I try to run chef client on a node with no environment set, the run dies at a later block in that very same recipe, (at a block which is also a consequence of having no environment set, but which is also less descriptive).
How / why would it be getting past a fatal log resource??