# File lib/puppet/application/kick.rb, line 166
166:   def setup
167:     if options[:debug]
168:       Puppet::Util::Log.level = :debug
169:     else
170:       Puppet::Util::Log.level = :info
171:     end
172: 
173:     # Now parse the config
174:     Puppet.parse_config
175: 
176:     if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes)
177:       if options[:all]
178:         @hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
179:         puts "all: #{@hosts.join(", ")}"
180:       else
181:         @hosts = []
182:         @classes.each do |klass|
183:           list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
184:           puts "#{klass}: #{list.join(", ")}"
185: 
186:           @hosts += list
187:         end
188:       end
189:     elsif ! @classes.empty?
190:       $stderr.puts "You must be using LDAP to specify host classes"
191:       exit(24)
192:     end
193: 
194:     @children = {}
195: 
196:     # If we get a signal, then kill all of our children and get out.
197:     [:INT, :TERM].each do |signal|
198:       trap(signal) do
199:         Puppet.notice "Caught #{signal}; shutting down"
200:         @children.each do |pid, host|
201:           Process.kill("INT", pid)
202:         end
203: 
204:         waitall
205: 
206:         exit(1)
207:       end
208:     end
209: 
210:   end