From 2c9f83a69053d351c16fcea38c9378caacf1717d Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 1 May 2014 15:26:34 -0700 Subject: [PATCH] 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... --- templates/provisioners/chef_solo/solo.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/provisioners/chef_solo/solo.erb b/templates/provisioners/chef_solo/solo.erb index cfd33cf9a..e97dae9b8 100644 --- a/templates/provisioners/chef_solo/solo.erb +++ b/templates/provisioners/chef_solo/solo.erb @@ -7,7 +7,7 @@ file_cache_path "<%= file_cache_path %>" file_backup_path "<%= file_backup_path %>" cookbook_path <%= cookbooks_path.inspect %> <% 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 %> else role_path <%= roles_path.inspect %>