Skip to content

Instantly share code, notes, and snippets.

@wijet
Created August 22, 2013 08:23
Show Gist options
  • Save wijet/6304518 to your computer and use it in GitHub Desktop.
Save wijet/6304518 to your computer and use it in GitHub Desktop.
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