OHAI Compile Error - undefined method `class_eval' for nil:NilClass

Hi All

I had nodes bootstrapping and running cookbooks correctly but noticed that the windows and ohai cookbooks were quite out of date. I updated those and now as soon as I try and run a cookbook on a node, I start getting the below. Has anyone else seen this?

Starting Chef Client, version 12.19.36
resolving cookbooks for run list: [“join.domain”]
Synchronizing Cookbooks:

  • windows (3.0.2)
  • join.domain (0.1.0)
  • ohai (5.0.1)
    Installing Cookbook Gems:
    Compiling Cookbooks…

================================================================================
Recipe Compile Error in c:/chef/cache/cookbooks/ohai/resources/hint.rb

NoMethodError

undefined method `class_eval’ for nil:NilClass

Cookbook Trace:

c:/chef/cache/cookbooks/ohai/resources/hint.rb:5:in `class_from_file’

Relevant File Content:

c:/chef/cache/cookbooks/ohai/resources/hint.rb:

1: property :hint_name, kind_of: String, name_attribute: true
2: property :content, kind_of: Hash
3: property :compile_time, [true, false], default: true
4:
5>> action_class.class_eval do
6: def ohai_hint_path
7: path = ::File.join(::Ohai::Config[:hints_path].first, new_resource.hint_name)
8: path << ‘.json’ unless path.end_with?(’.json’)
9: path
10: end
11:
12: def build_content
13: # passing nil to file produces deprecation warnings so pass an empty string
14: return nil if new_resource.content.nil? || new_resource.content.empty?

Platform:

x64-mingw32

Running handlers:

  • AzureExtension::ExceptionHandler
    Running handlers complete
    Chef Client failed. 0 resources updated in 09 seconds
    PS C:\Users\ServerTeam>

This is a known reversion, please stay tuned for more details but we’re working on sorting it out in both Chef and the affected cookbooks. For the moment you can probably drop back to 12.18 instead to unblock things. We apologize for the trouble.

Great, thanks for that. I’ll give it a go.