-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
We've seen an issue with Chef client 12.12.13 and Ohai version 8.12.1.
It appears that Ohai is now scraping the timezone for Chef Client, this means that when you try and set node.default['timezone'] it will fail as the hash is already populated with a string value (and not another hash).
Two pieces of evidence show this
Loading Chef-Shell
$ chef-shell
loading configuration: none (standalone session)
Session type: standalone
Loading....done.
This is the chef-shell.
Chef Version: 12.12.13
http://www.chef.io/
http://docs.chef.io/
run `help' for help, `exit' or ^D to quit.
Ohai2u [email protected]!
chef (12.12.13)> node.timezone
[2016-07-07T12:25:10+01:00] WARN: "method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) at (irb):1:in `irb_binding'
=> "BST"
chef (12.12.13)> node['timezone']
=> "BST"
chef (12.12.13)> node['timezone'].keys
NoMethodError: undefined method `keys' for "BST":String
from (irb):3
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.13/lib/chef/shell.rb:75:in `block in start'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.13/lib/chef/shell.rb:74:in `catch'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.13/lib/chef/shell.rb:74:in `start'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.13/bin/chef-shell:34:in `<top (required)>'
from /usr/bin/chef-shell:52:in `load'
from /usr/bin/chef-shell:52:in `<main>'
chef (12.12.13)> node.debug_value('timezone')
=> [["default", :not_present], ["env_default", :not_present], ["role_default", :not_present], ["force_default", :not_present], ["normal", :not_present], ["override", :not_present], ["role_override", :not_present], ["env_override", :not_present], ["force_override", :not_present], ["automatic", "BST"]]
The attribute precedent level is automatic which indicates Ohai, running Ohai on command line and grep for timezone shows this.
Can you namespace the timezone attribute to protect from the values gathered by Ohai?
As an aside, there is a deprecation warning for separating attributes with the dot format.
[2016-07-07T12:25:10+01:00] WARN: "method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) at (irb):1:in `irb_binding'
Metadata
Metadata
Assignees
Labels
No labels