From a2bee0c524829af7d6dc8867cc2c98c9b059e093 Mon Sep 17 00:00:00 2001 From: Jordan Evans Date: Wed, 22 Apr 2015 15:30:49 -0700 Subject: use Chef::VersionConstraint::Platform in value_for_platform Previously this was using Chef::VersionConstraint, which throws an exception when presented with a version of the form x, where x is a number. Since platforms can have this as a valid version, we should use Chef::VersionConstraint::Platform --- lib/chef/dsl/platform_introspection.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb index 2a52010a70..a6bd12d2ef 100644 --- a/lib/chef/dsl/platform_introspection.rb +++ b/lib/chef/dsl/platform_introspection.rb @@ -50,7 +50,7 @@ class Chef def value_for_node(node) platform, version = node[:platform].to_s, node[:platform_version].to_s - # Check if we match a version constraint via Chef::VersionConstraint and Chef::Version::Platform + # Check if we match a version constraint via Chef::VersionConstraint::Platform and Chef::Version::Platform matched_value = match_versions(node) if @values.key?(platform) && @values[platform].key?(version) @values[platform][version] @@ -76,11 +76,11 @@ class Chef keys = @values[platform].keys keys.each do |k| begin - if Chef::VersionConstraint.new(k).include?(node_version) + if Chef::VersionConstraint::Platform.new(k).include?(node_version) key_matches << k end rescue Chef::Exceptions::InvalidVersionConstraint => e - Chef::Log.debug "Caught InvalidVersionConstraint. This means that a key in value_for_platform cannot be interpreted as a Chef::VersionConstraint." + Chef::Log.debug "Caught InvalidVersionConstraint. This means that a key in value_for_platform cannot be interpreted as a Chef::VersionConstraint::Platform." Chef::Log.debug(e) end end -- cgit v1.2.1