raiseが使えそうです。
sample.rb
Chef::Log::info( node.chef_environment + " is environment." )
if node.chef_environment != "production"
raise "Environment does not match!"
end
結果
[root@chef ~]# chef-client
[2013-01-10T14:44:11+09:00] INFO: *** Chef 10.14.4 ***
...
[2013-01-10T14:47:10+09:00] INFO: _default is environment.
...
RuntimeError
------------
Environment does not match!
...
Cookbook Trace:
...
14>> raise "Environment does not match!"
※単にEnvironment別の処理をするだけならEnvironmentの機能を使ってもできます。