Class: Puppet::Application::Master
Constant Summary
DOCPATTERN
Instance Attribute Summary
#command_line, #options
Instance Method Summary
collapse
[], banner, clear!, clear?, controlled_run, exit, find, #handlearg, #help, #initialize, interrupted?, #name, option, option_parser_commands, #parse_options, restart!, restart_requested?, #run, run_mode, #set_run_mode, should_not_parse_config, should_parse_config, should_parse_config?, #should_parse_config?, stop!, stop_requested?
Methods included from Util
activerecord_version, benchmark, chuser, classproxy, #execfail, #execpipe, execute, logmethods, memory, proxy, recmkdir, secure_open, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, which, withumask
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Instance Method Details
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/puppet/application/master.rb', line 50
def compile
Puppet::Util::Log.newdestination :console
raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson?
begin
unless catalog = Puppet::Resource::Catalog.find(options[:node])
raise "Could not compile catalog for #{options[:node]}"
end
jj catalog.to_resource
rescue => detail
$stderr.puts detail
exit(30)
end
exit(0)
end
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/puppet/application/master.rb', line 76
def main
require 'etc'
require 'puppet/file_serving/content'
require 'puppet/file_serving/metadata'
xmlrpc_handlers = [:Status, :FileServer, :Master, :Report, :Filebucket]
xmlrpc_handlers << :CA if Puppet[:ca]
Puppet::SSL::Host.localhost
Puppet::SSL::Host.ca_location = :only if Puppet::SSL::CertificateAuthority.ca?
if Puppet.features.root?
begin
Puppet::Util.chuser
rescue => detail
puts detail.backtrace if Puppet[:trace]
$stderr.puts "Could not change user to #{Puppet[:user]}: #{detail}"
exit(39)
end
end
unless options[:rack]
require 'puppet/network/server'
@daemon.server = Puppet::Network::Server.new(:xmlrpc_handlers => xmlrpc_handlers)
@daemon.daemonize if Puppet[:daemonize]
else
require 'puppet/network/http/rack'
@app = Puppet::Network::HTTP::Rack.new(:xmlrpc_handlers => xmlrpc_handlers, :protocols => [:rest, :xmlrpc])
end
Puppet.notice "Starting Puppet master version #{Puppet.version}"
unless options[:rack]
@daemon.start
else
return @app
end
end
|
#parseonly ⇒ Object
66
67
68
69
70
71
72
73
74
|
# File 'lib/puppet/application/master.rb', line 66
def parseonly
begin
Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types
rescue => detail
Puppet.err detail
exit 1
end
exit(0)
end
|
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/puppet/application/master.rb', line 28
def preinit
Signal.trap(:INT) do
$stderr.puts "Cancelling startup"
exit(0)
end
require 'puppet/daemon'
@daemon = Puppet::Daemon.new
@daemon.argv = ARGV.dup
end
|
#run_command ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/puppet/application/master.rb', line 40
def run_command
if options[:node]
compile
elsif Puppet[:parseonly]
parseonly
else
main
end
end
|