fix chef version checking

the version checking here uses a function which is intended only
for chef cookbook versions, which must be x.y or x.y.z.  when fed
a legal chef prerelease version the prior code throws an exception:

[2014-05-01T22:08:01+00:00] FATAL: Configuration error Chef::Exceptions::InvalidCookbookVersion: '11.14.0.alpha.1' does not match 'x.y.z' or 'x.y'
[2014-05-01T22:08:01+00:00] FATAL:   /tmp/vagrant-chef-2/solo.rb:6:in `from_string'
[2014-05-01T22:08:01+00:00] FATAL: Aborting due to error in '/tmp/vagrant-chef-2/solo.rb'

since we only need to compare the major and minor version numbers a
simple #to_f sufficies for this test.

alternative, we could use Gem::Version here, but i didn't really see
the need to...
This commit is contained in:
Lamont Granquist 2014-05-01 15:26:34 -07:00
parent 1b698f6ce8
commit 2c9f83a690
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ file_cache_path "<%= file_cache_path %>"
file_backup_path "<%= file_backup_path %>" file_backup_path "<%= file_backup_path %>"
cookbook_path <%= cookbooks_path.inspect %> cookbook_path <%= cookbooks_path.inspect %>
<% if roles_path %> <% if roles_path %>
if Chef::VersionConstraint.new("< 11.8.0").include?(Chef::VERSION) if Chef::VERSION.to_f < 11.8
role_path <%= roles_path.first.inspect %> role_path <%= roles_path.first.inspect %>
else else
role_path <%= roles_path.inspect %> role_path <%= roles_path.inspect %>