diff options
Diffstat (limited to 'lib/chef/mixin/versioned_api.rb')
-rw-r--r-- | lib/chef/mixin/versioned_api.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/mixin/versioned_api.rb b/lib/chef/mixin/versioned_api.rb index 17c9838d29..3a62c98fe1 100644 --- a/lib/chef/mixin/versioned_api.rb +++ b/lib/chef/mixin/versioned_api.rb @@ -44,12 +44,12 @@ class Chef end def get_class_for(type) - versioned_interfaces.select do |klass| + versioned_interfaces.select { |klass| version = klass.send(:minimum_api_version) # min and max versions will be nil if we've not made a request to the server yet, # in which case we'll just start with the highest version and see what happens ServerAPIVersions.instance.min_server_version.nil? || (version >= ServerAPIVersions.instance.min_server_version && version <= ServerAPIVersions.instance.send(type)) - end + } .sort { |a, b| a.send(:minimum_api_version) <=> b.send(:minimum_api_version) } .last end |