Created
August 22, 2013 08:23
-
-
Save wijet/6304518 to your computer and use it in GitHub Desktop.
Monkey patch for http://tickets.opscode.com/browse/CHEF-3832
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chef | |
module DSL | |
module DataQuery | |
# http://tickets.opscode.com/browse/CHEF-3832 | |
# Monkey patched so that search always returns nodes sorted by name | |
def search(*args, &block) | |
if Kernel.block_given? || args.length >= 4 | |
Chef::Search::Query.new.search(*args, &block) | |
else | |
results = Array.new | |
Chef::Search::Query.new.search(*args) do |o| | |
results << o | |
end | |
if args.first.to_sym == :node | |
results.sort_by(&:name) | |
else | |
results | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment