From c6a87f8610ab14a36185f5a5f9e20158f18f0f9b Mon Sep 17 00:00:00 2001 From: Xabier de Zuazo Date: Mon, 18 Feb 2013 11:20:08 +0100 Subject: [CHEF-3919] rescue from an InvalidCookbookVersion exception inside Chef::Platform when platform version cannot be parsed properly --- lib/chef/platform.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/chef/platform.rb b/lib/chef/platform.rb index f7c94072a1..b2b22a88ff 100644 --- a/lib/chef/platform.rb +++ b/lib/chef/platform.rb @@ -350,10 +350,14 @@ class Chef provider_map.merge!(platforms[name_sym][:default]) end platform_versions.each do |platform_version, provider| - version_constraint = Chef::VersionConstraint.new(platform_version) - if version_constraint.include?(version) - Chef::Log.debug("Platform #{name.to_s} version #{version} found") - provider_map.merge!(provider) + begin + version_constraint = Chef::VersionConstraint.new(platform_version) + if version_constraint.include?(version) + Chef::Log.debug("Platform #{name.to_s} version #{version} found") + provider_map.merge!(provider) + end + rescue Chef::Exceptions::InvalidCookbookVersion + Chef::Log.debug("Chef::Version::Comparable does not know how to parse the platform version") end end else -- cgit v1.2.1