[chef] Dealing with back level ohai


Chronological Thread 
  • From: Booker Bense < >
  • To:
  • Subject: [chef] Dealing with back level ohai
  • Date: Wed, 23 Jan 2013 11:00:13 -0800


What is the "right" way to deal with this problem? I'm using vagrant and some boxes come with old versions of ohai that cause failures in the chef run. 

The segment below in build-essentials is the current example. 

# Older versions of ohai do not provide a platform_family 
  # Is crashing out with nil method error for the packages.each
  # statement okay or should we silently do nothing or ? 

  packages = case node['platform_family']
    when "debian"
      %w{build-essential binutils-doc}
    when "rhel", "fedora"
      %w{gcc gcc-c++ kernel-devel make}
    when "suse"
      %w{gcc gcc-c++ kernel-default-devel make m4}  # in SLES there is no kernel-devel
    end

If packages is nil after this case statement what is the correct action to take? 

Ideally, I'd like a warning to pop up like 

"Hey, your version of ohai is too old, please upgrade" 

If the chef run fails, fine but at least print a useful error message. 

- Booker C. Bense 





Archive powered by MHonArc 2.6.16.

§