197: def setup
198: setup_test if options[:test]
199:
200: setup_logs
201:
202: exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
203:
204:
205: Puppet[:show_diff] = true if Puppet[:noop]
206:
207: args[:Server] = Puppet[:server]
208: if options[:fqdn]
209: args[:FQDN] = options[:fqdn]
210: Puppet[:certname] = options[:fqdn]
211: end
212:
213: if options[:centrallogs]
214: logdest = args[:Server]
215:
216: logdest += ":" + args[:Port] if args.include?(:Port)
217: Puppet::Util::Log.newdestination(logdest)
218: end
219:
220: Puppet.settings.use :main, :agent, :ssl
221:
222:
223:
224: Puppet[:ignoreimport] = true
225:
226:
227:
228:
229: Puppet::SSL::Host.ca_location = options[:fingerprint] ? :none : :remote
230:
231: Puppet::Transaction::Report.terminus_class = :rest
232:
233:
234:
235: Puppet[:catalog_terminus] = :rest
236:
237:
238: Puppet[:facts_terminus] = :facter
239:
240: Puppet::Resource::Catalog.cache_class = :yaml
241:
242:
243:
244:
245: require 'puppet/agent'
246: require 'puppet/configurer'
247: @agent = Puppet::Agent.new(Puppet::Configurer)
248:
249: enable_disable_client(@agent) if options[:enable] or options[:disable]
250:
251: @daemon.agent = agent if options[:client]
252:
253:
254:
255: @daemon.daemonize if Puppet[:daemonize]
256:
257: setup_host
258:
259: @objects = []
260:
261:
262: if Puppet[:listen]
263: unless Puppet[:onetime]
264: setup_listen
265: else
266: Puppet.notice "Ignoring --listen on onetime run"
267: end
268: end
269: end