Created
February 5, 2013 20:07
-
-
Save atomic-penguin/4717224 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chef > if node['kernel']['modules'].has_key('ip6tables') | |
| chef ?> puts "true" | |
| chef ?> end | |
| NoMethodError: Undefined node attribute or method `has_key' on `node' | |
| from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.0.0/lib/chef/node/immutable_collections.rb:164:in `method_missing' | |
| from (irb):4 | |
| from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.0.0/lib/chef/shell.rb:73:in `block in start' | |
| from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.0.0/lib/chef/shell.rb:72:in `catch' | |
| from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.0.0/lib/chef/shell.rb:72:in `start' | |
| from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.0.0/bin/shef:35:in `<top (required)>' | |
| from /usr/bin/shef:23:in `load' | |
| from /usr/bin/shef:23:in `<main>' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This worked on Chef <= 10.X.
On Chef >= 11.X it seems hash methods are not allowed on node attributes.
EDIT: Requires using a
?on the.has_key?method call.