Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add version checks and update History.txt

  • Loading branch information...
commit eafd5b174d0d6ea4182401ef695cc252203817a1 1 parent 64e3eb5
Leif Madsen authored
Showing with 23 additions and 1 deletion.
  1. +6 −0 History.txt
  2. +17 −1 lib/minitest-chef-handler/resources.rb
View
6 History.txt
@@ -1,3 +1,9 @@
+=== 0.6.3 / 09-25-2012
+
+* 1 bug fix:
+
+ * Fix usage of Chef::Platform.provider_for_resource usage with Chef >= 10.14.0.
+
=== 0.6.2 / 09-16-2012
* 1 bug fix:
View
18 lib/minitest-chef-handler/resources.rb
@@ -14,7 +14,23 @@ def self.register_resource(resource, *required_args)
required_args.each do |arg|
res.send(arg, options.first[arg])
end
- provider = ::Chef::Platform.provider_for_resource(res, :create)
+
+ # in Chef 10.14.0 an additional argument was added to Chef::Platform.provider_for_resource
+ # so we check the version here and use it if it is available
+ chef_version = node['chef_packages']['chef']['version'].to_s
+
+ case
+ when chef_version.split(".",2).first.to_i < 10
+ provider = ::Chef::Platform.provider_for_resource(res)
+ when chef_version.split(".",2).first.to_i > 10
+ provider = ::Chef::Platform.provider_for_resource(res, :create)
+ else
+ if chef_version.split(".",2).last.to_i < 14
+ provider = ::Chef::Platform.provider_for_resource(res)
+ else
+ provider = ::Chef::Platform.provider_for_resource(res, :create)
+ end
+ end
provider.load_current_resource
provider.current_resource
end
Please sign in to comment.
Something went wrong with that request. Please try again.