I am working on writing a cookbook which uses the community ohai cookbook to download and install some custom Ohai plugins I have written.
The issue I am having is that our infrastructure has clients running versions ranging from 12.4 to 14. So when Chef tries to compile the Ohai cookbook, it fails because it uses parts of the LWRP DSL that (afaik) only work on Chef versions >= 12.7.
I do not need the cookbook to actually work on versions prior to 12.7, since these are a few outliers. In fact, the desired behavior is for it to be a no-op on older clients. However, the 12.4 boxes are most likely going to be around for a while longer, and we would prefer to not need to downgrade the Ohai cookbook version since it works for the supermajority of our infrastructure. But we want to add these cookbooks to our platform run lists, which need to support any VM we have on that platform.
Since I don't need these cookbooks to work on old versions of Chef, is there anyway for me to tell old clients: "if you're on a Chef version less than 12.7, ignore these and don't even attempt to compile them"? Both my cookbooks and the Ohai cookbook have chef_version '>= 12.7' if respond_to?(:chef_version)
in their respective metadata.rb
files.
I have also posted this question on Stack Overflow, but the only answer has not yielded worthwhile results.