Module: TP

Defined in:
lib/chef/knife/replace.rb

Defined Under Namespace

Classes: RoleAdd, RoleReplace

Class Method Summary collapse

Class Method Details

.search(attribute = "*", value = "*", include_node_data = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/chef/knife/replace.rb', line 5

def self.search(attribute = "*", value = "*", include_node_data = false)
  response = include_node_data ? {} : []
  Chef::Search::Query.new.search(:node, attribute+":"+value) do |n|
    if include_node_data then
      response[n.name] = n unless n.nil?
    else
      response << n.name unless n.nil?
    end
  end
  response
end