Created
June 7, 2010 14:47
-
-
Save jtimberman/428751 to your computer and use it in GitHub Desktop.
Chef version checking in recipes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# access chef's version constant directly | |
if Chef::VERSION.to_f >= 0.8 | |
# 0.8+ only features here | |
end | |
# node attribute, requires ohai version 0.5.4: | |
if node.chef_packages.chef.version.to_f >= 0.8 | |
# 0.8+ only features here | |
end |
or Chef::VERSION >= 13.0
in recent enough chef-client where Chef::VERSION is a Chef::VersionString object.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gem::Requirement.new(">= 0.8").satisfied_by?(Gem::Version.new(Chef::VERSION))