Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chef 13 and Ohai 8 errors #33

Open
chrisgit opened this issue Jul 7, 2016 · 0 comments
Open

Chef 13 and Ohai 8 errors #33

chrisgit opened this issue Jul 7, 2016 · 0 comments

Comments

@chrisgit
Copy link

chrisgit commented Jul 7, 2016

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant