mcollective-client 2.2.4 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mcollective-client might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/lib/mcollective/application.rb +25 -34
- data/lib/mcollective/client.rb +91 -33
- data/lib/mcollective/config.rb +42 -43
- data/lib/mcollective/data/base.rb +1 -1
- data/lib/mcollective/data/result.rb +6 -2
- data/lib/mcollective/ddl/agentddl.rb +28 -1
- data/lib/mcollective/ddl/base.rb +8 -6
- data/lib/mcollective/log.rb +11 -3
- data/lib/mcollective/logger/file_logger.rb +4 -4
- data/lib/mcollective/matcher.rb +9 -1
- data/lib/mcollective/message.rb +14 -23
- data/lib/mcollective/optionparser.rb +9 -1
- data/lib/mcollective/pluginpackager.rb +24 -3
- data/lib/mcollective/pluginpackager/agent_definition.rb +12 -12
- data/lib/mcollective/pluginpackager/standard_definition.rb +12 -12
- data/lib/mcollective/rpc/agent.rb +15 -12
- data/lib/mcollective/rpc/client.rb +67 -31
- data/lib/mcollective/rpc/helpers.rb +7 -1
- data/lib/mcollective/rpc/reply.rb +3 -1
- data/lib/mcollective/shell.rb +45 -8
- data/lib/mcollective/util.rb +37 -1
- data/lib/mcollective/windows_daemon.rb +14 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/application_spec.rb +45 -26
- data/spec/unit/cache_spec.rb +3 -3
- data/spec/unit/client_spec.rb +269 -24
- data/spec/unit/config_spec.rb +89 -26
- data/spec/unit/data/base_spec.rb +1 -0
- data/spec/unit/data/result_spec.rb +19 -1
- data/spec/unit/data_spec.rb +3 -0
- data/spec/unit/ddl/agentddl_spec.rb +32 -0
- data/spec/unit/ddl/base_spec.rb +4 -0
- data/spec/unit/ddl/dataddl_spec.rb +1 -1
- data/spec/unit/log_spec.rb +44 -27
- data/spec/unit/logger/base_spec.rb +1 -1
- data/spec/unit/matcher_spec.rb +14 -0
- data/spec/unit/message_spec.rb +24 -0
- data/spec/unit/optionparser_spec.rb +99 -0
- data/spec/unit/pluginpackager/agent_definition_spec.rb +48 -17
- data/spec/unit/pluginpackager/standard_definition_spec.rb +44 -20
- data/spec/unit/pluginpackager_spec.rb +31 -7
- data/spec/unit/plugins/mcollective/agent/rpcutil_spec.rb +176 -0
- data/spec/unit/plugins/mcollective/application/plugin_spec.rb +81 -0
- data/spec/unit/plugins/mcollective/audit/logfile_spec.rb +44 -0
- data/spec/unit/plugins/mcollective/connector/activemq_spec.rb +118 -27
- data/spec/unit/plugins/mcollective/connector/rabbitmq_spec.rb +168 -34
- data/spec/unit/plugins/mcollective/data/agent_data_spec.rb +1 -0
- data/spec/unit/plugins/mcollective/data/fstat_data_spec.rb +1 -0
- data/spec/unit/plugins/mcollective/discovery/flatfile_spec.rb +10 -0
- data/spec/unit/plugins/mcollective/discovery/stdin_spec.rb +65 -0
- data/spec/unit/plugins/mcollective/facts/yaml_facts_spec.rb +65 -0
- data/spec/unit/plugins/mcollective/packagers/debpackage_packager_spec.rb +240 -219
- data/spec/unit/plugins/mcollective/packagers/modulepackage_packager_spec.rb +209 -0
- data/spec/unit/plugins/mcollective/packagers/rpmpackage_packager_spec.rb +223 -109
- data/spec/unit/rpc/actionrunner_spec.rb +2 -1
- data/spec/unit/rpc/agent_spec.rb +130 -1
- data/spec/unit/rpc/client_spec.rb +169 -3
- data/spec/unit/security/base_spec.rb +0 -1
- data/spec/unit/shell_spec.rb +76 -3
- data/spec/unit/util_spec.rb +69 -1
- data/spec/unit/windows_daemon_spec.rb +30 -9
- metadata +104 -90
- data/spec/unit/plugins/mcollective/connector/stomp/eventlogger_spec.rb +0 -34
- data/spec/unit/plugins/mcollective/connector/stomp_spec.rb +0 -424
- data/spec/unit/plugins/mcollective/validator/any_validator_spec.rb +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56381fee132b101d5841676045d4294419404fba
|
4
|
+
data.tar.gz: cfeb66a43d1179d79489d9dfef032d936bdda499
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 44e8c61ac26956818a744e4a3daa1b5513a6da8c80b25747d9864d2394825337438817eeab07b8edd195947ea123d07310d1479df84c1ad09e75823a94e71998
|
7
|
+
data.tar.gz: b09053846889112bdad071459484f8511418a0fef51e1a26d3d2b39a04b34f7e2d9d87752ff0beb96785f3acd463d9b0a69234f892ca0a6177458895ca824090
|
@@ -149,6 +149,8 @@ module MCollective
|
|
149
149
|
parser.separator ""
|
150
150
|
end
|
151
151
|
|
152
|
+
parser.separator "Application Options" unless application_cli_arguments.empty?
|
153
|
+
|
152
154
|
parser.define_tail ""
|
153
155
|
parser.define_tail "The Marionette Collective #{MCollective.version}"
|
154
156
|
|
@@ -180,7 +182,7 @@ module MCollective
|
|
180
182
|
parser.send(*opts_array) do |v|
|
181
183
|
validate_option(carg[:validate], carg[:name], v)
|
182
184
|
|
183
|
-
configuration[carg[:name]] =
|
185
|
+
configuration[carg[:name]] = v
|
184
186
|
end
|
185
187
|
|
186
188
|
elsif carg[:type] == :array
|
@@ -255,7 +257,11 @@ module MCollective
|
|
255
257
|
raise(e)
|
256
258
|
end
|
257
259
|
|
258
|
-
|
260
|
+
if options[:verbose]
|
261
|
+
err_dest.puts "\nThe %s application failed to run: %s\n" % [ Util.colorize(:bold, $0), Util.colorize(:red, e.to_s)]
|
262
|
+
else
|
263
|
+
err_dest.puts "\nThe %s application failed to run, use -v for full error backtrace details: %s\n" % [ Util.colorize(:bold, $0), Util.colorize(:red, e.to_s)]
|
264
|
+
end
|
259
265
|
|
260
266
|
if options.nil? || options[:verbose]
|
261
267
|
e.backtrace.first << Util.colorize(:red, " <----")
|
@@ -302,46 +308,31 @@ module MCollective
|
|
302
308
|
exit 1
|
303
309
|
end
|
304
310
|
|
311
|
+
def halt_code(stats)
|
312
|
+
request_stats = {:discoverytime => 0,
|
313
|
+
:discovered => 0,
|
314
|
+
:okcount => 0,
|
315
|
+
:failcount => 0}.merge(stats.to_hash)
|
316
|
+
|
317
|
+
return 4 if request_stats[:discoverytime] == 0 && request_stats[:responses] == 0
|
318
|
+
return 3 if request_stats[:discovered] > 0 && request_stats[:responses] == 0
|
319
|
+
return 2 if request_stats[:discovered] > 0 && request_stats[:failcount] > 0
|
320
|
+
return 1 if request_stats[:discovered] == 0
|
321
|
+
return 0 if request_stats[:discoverytime] == 0 && request_stats[:discovered] == request_stats[:okcount]
|
322
|
+
return 0 if request_stats[:discovered] == request_stats[:okcount]
|
323
|
+
end
|
324
|
+
|
305
325
|
# A helper that creates a consistent exit code for applications by looking at an
|
306
326
|
# instance of MCollective::RPC::Stats
|
307
327
|
#
|
308
328
|
# Exit with 0 if nodes were discovered and all passed
|
309
|
-
# Exit with 0 if no discovery were done and > 0 responses were received
|
329
|
+
# Exit with 0 if no discovery were done and > 0 responses were received, all ok
|
310
330
|
# Exit with 1 if no nodes were discovered
|
311
331
|
# Exit with 2 if nodes were discovered but some RPC requests failed
|
312
|
-
# Exit with 3 if nodes were discovered, but
|
332
|
+
# Exit with 3 if nodes were discovered, but no responses received
|
313
333
|
# Exit with 4 if no discovery were done and no responses were received
|
314
334
|
def halt(stats)
|
315
|
-
|
316
|
-
:discovered => 0,
|
317
|
-
:failcount => 0}.merge(stats.to_hash)
|
318
|
-
|
319
|
-
# was discovery done?
|
320
|
-
if request_stats[:discoverytime] != 0
|
321
|
-
# was any nodes discovered
|
322
|
-
if request_stats[:discovered] == 0
|
323
|
-
exit 1
|
324
|
-
|
325
|
-
# nodes were discovered, did we get responses
|
326
|
-
elsif request_stats[:responses] == 0
|
327
|
-
exit 3
|
328
|
-
|
329
|
-
else
|
330
|
-
# we got responses and discovery was done, no failures
|
331
|
-
if request_stats[:failcount] == 0
|
332
|
-
exit 0
|
333
|
-
else
|
334
|
-
exit 2
|
335
|
-
end
|
336
|
-
end
|
337
|
-
else
|
338
|
-
# discovery wasnt done and we got no responses
|
339
|
-
if request_stats[:responses] == 0
|
340
|
-
exit 4
|
341
|
-
else
|
342
|
-
exit 0
|
343
|
-
end
|
344
|
-
end
|
335
|
+
exit(halt_code(stats))
|
345
336
|
end
|
346
337
|
|
347
338
|
# Wrapper around MC::RPC#rpcclient that forcably supplies our options hash
|
data/lib/mcollective/client.rb
CHANGED
@@ -37,6 +37,15 @@ module MCollective
|
|
37
37
|
# Sends a request and returns the generated request id, doesn't wait for
|
38
38
|
# responses and doesn't execute any passed in code blocks for responses
|
39
39
|
def sendreq(msg, agent, filter = {})
|
40
|
+
request = createreq(msg, agent, filter)
|
41
|
+
|
42
|
+
Log.debug("Sending request #{request.requestid} to the #{request.agent} agent with ttl #{request.ttl} in collective #{request.collective}")
|
43
|
+
|
44
|
+
request.publish
|
45
|
+
request.requestid
|
46
|
+
end
|
47
|
+
|
48
|
+
def createreq(msg, agent, filter ={})
|
40
49
|
if msg.is_a?(Message)
|
41
50
|
request = msg
|
42
51
|
agent = request.agent
|
@@ -47,14 +56,8 @@ module MCollective
|
|
47
56
|
end
|
48
57
|
|
49
58
|
request.encode!
|
50
|
-
|
51
|
-
Log.debug("Sending request #{request.requestid} to the #{request.agent} agent with ttl #{request.ttl} in collective #{request.collective}")
|
52
|
-
|
53
59
|
subscribe(agent, :reply) unless request.reply_to
|
54
|
-
|
55
|
-
request.publish
|
56
|
-
|
57
|
-
request.requestid
|
60
|
+
request
|
58
61
|
end
|
59
62
|
|
60
63
|
def subscribe(agent, type)
|
@@ -91,15 +94,14 @@ module MCollective
|
|
91
94
|
reply.expected_msgid = requestid
|
92
95
|
|
93
96
|
reply.decode!
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
raise(MsgDoesNotMatchRequestID, "Message reqid #{requestid} does not match our reqid #{reply.requestid}") unless reply.requestid == requestid
|
97
|
+
unless reply.requestid == requestid
|
98
|
+
raise(MsgDoesNotMatchRequestID, "Message reqid #{reply.requestid} does not match our reqid #{requestid}")
|
99
|
+
end
|
98
100
|
rescue SecurityValidationFailed => e
|
99
101
|
Log.warn("Ignoring a message that did not pass security validations")
|
100
102
|
retry
|
101
103
|
rescue MsgDoesNotMatchRequestID => e
|
102
|
-
Log.debug("Ignoring a message for some other client")
|
104
|
+
Log.debug("Ignoring a message for some other client : #{e.message}")
|
103
105
|
retry
|
104
106
|
end
|
105
107
|
|
@@ -124,7 +126,7 @@ module MCollective
|
|
124
126
|
#
|
125
127
|
# It returns a hash of times and timeouts for discovery and total run is taken from the options
|
126
128
|
# hash which in turn is generally built using MCollective::Optionparser
|
127
|
-
def req(body, agent=nil, options=false, waitfor=0)
|
129
|
+
def req(body, agent=nil, options=false, waitfor=0, &block)
|
128
130
|
if body.is_a?(Message)
|
129
131
|
agent = body.agent
|
130
132
|
waitfor = body.discovered_hosts.size || 0
|
@@ -132,46 +134,102 @@ module MCollective
|
|
132
134
|
end
|
133
135
|
|
134
136
|
@options = options if options
|
135
|
-
|
136
|
-
stat = {:starttime => Time.now.to_f, :discoverytime => 0, :blocktime => 0, :totaltime => 0}
|
137
|
-
|
137
|
+
threaded = @options[:threaded]
|
138
138
|
timeout = @discoverer.discovery_timeout(@options[:timeout], @options[:filter])
|
139
|
-
|
139
|
+
request = createreq(body, agent, @options[:filter])
|
140
|
+
publish_timeout = @options[:publish_timeout]
|
141
|
+
stat = {:starttime => Time.now.to_f, :discoverytime => 0, :blocktime => 0, :totaltime => 0}
|
140
142
|
STDOUT.sync = true
|
141
|
-
|
142
143
|
hosts_responded = 0
|
143
|
-
|
144
|
+
|
144
145
|
|
145
146
|
begin
|
146
|
-
|
147
|
+
if threaded
|
148
|
+
hosts_responded = threaded_req(request, publish_timeout, timeout, waitfor, &block)
|
149
|
+
else
|
150
|
+
hosts_responded = unthreaded_req(request, publish_timeout, timeout, waitfor, &block)
|
151
|
+
end
|
152
|
+
rescue Interrupt => e
|
153
|
+
ensure
|
154
|
+
unsubscribe(agent, :reply)
|
155
|
+
end
|
147
156
|
|
148
|
-
|
149
|
-
|
157
|
+
return update_stat(stat, hosts_responded, request.requestid)
|
158
|
+
end
|
150
159
|
|
151
|
-
|
152
|
-
|
160
|
+
# Starts the client receiver and publisher unthreaded.
|
161
|
+
# This is the default client behaviour.
|
162
|
+
def unthreaded_req(request, publish_timeout, timeout, waitfor, &block)
|
163
|
+
start_publisher(request, publish_timeout)
|
164
|
+
start_receiver(request.requestid, waitfor, timeout, &block)
|
165
|
+
end
|
153
166
|
|
154
|
-
|
167
|
+
# Starts the client receiver and publisher in threads.
|
168
|
+
# This is activated when the 'threader_client' configuration
|
169
|
+
# option is set.
|
170
|
+
def threaded_req(request, publish_timeout, timeout, waitfor, &block)
|
171
|
+
Log.debug("Starting threaded client")
|
172
|
+
publisher = Thread.new do
|
173
|
+
start_publisher(request, publish_timeout)
|
174
|
+
end
|
155
175
|
|
156
|
-
|
176
|
+
# When the client is threaded we add the publishing timeout to
|
177
|
+
# the agent timeout so that the receiver doesn't time out before
|
178
|
+
# publishing has finished in cases where publish_timeout >= timeout.
|
179
|
+
total_timeout = publish_timeout + timeout
|
180
|
+
hosts_responded = 0
|
181
|
+
|
182
|
+
receiver = Thread.new do
|
183
|
+
hosts_responded = start_receiver(request.requestid, waitfor, total_timeout, &block)
|
184
|
+
end
|
157
185
|
|
158
|
-
|
159
|
-
|
186
|
+
receiver.join
|
187
|
+
hosts_responded
|
188
|
+
end
|
189
|
+
|
190
|
+
# Starts the request publishing routine
|
191
|
+
def start_publisher(request, publish_timeout)
|
192
|
+
Log.debug("Starting publishing with publish timeout of #{publish_timeout}")
|
193
|
+
begin
|
194
|
+
Timeout.timeout(publish_timeout) do
|
195
|
+
Log.debug("Sending request #{request.requestid} to the #{request.agent} agent with ttl #{request.ttl} in collective #{request.collective}")
|
196
|
+
request.publish
|
160
197
|
end
|
161
|
-
rescue Interrupt => e
|
162
198
|
rescue Timeout::Error => e
|
163
|
-
|
164
|
-
|
199
|
+
Log.warn("Could not publish all messages. Publishing timed out.")
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Starts the response receiver routine
|
204
|
+
# Expected to return the amount of received responses.
|
205
|
+
def start_receiver(requestid, waitfor, timeout, &block)
|
206
|
+
Log.debug("Starting response receiver with timeout of #{timeout}")
|
207
|
+
hosts_responded = 0
|
208
|
+
begin
|
209
|
+
Timeout.timeout(timeout) do
|
210
|
+
begin
|
211
|
+
resp = receive(requestid)
|
212
|
+
yield resp.payload
|
213
|
+
hosts_responded += 1
|
214
|
+
end while (waitfor == 0 || hosts_responded < waitfor)
|
215
|
+
end
|
216
|
+
rescue Timeout::Error => e
|
217
|
+
if (waitfor > hosts_responded)
|
218
|
+
Log.warn("Could not receive all responses. Expected : #{waitfor}. Received : #{hosts_responded}")
|
219
|
+
end
|
165
220
|
end
|
166
221
|
|
222
|
+
hosts_responded
|
223
|
+
end
|
224
|
+
|
225
|
+
def update_stat(stat, hosts_responded, requestid)
|
167
226
|
stat[:totaltime] = Time.now.to_f - stat[:starttime]
|
168
227
|
stat[:blocktime] = stat[:totaltime] - stat[:discoverytime]
|
169
228
|
stat[:responses] = hosts_responded
|
170
229
|
stat[:noresponsefrom] = []
|
171
|
-
stat[:requestid] =
|
230
|
+
stat[:requestid] = requestid
|
172
231
|
|
173
232
|
@stats = stat
|
174
|
-
return stat
|
175
233
|
end
|
176
234
|
|
177
235
|
def discovered_req(body, agent, options=false)
|
data/lib/mcollective/config.rb
CHANGED
@@ -5,16 +5,17 @@ module MCollective
|
|
5
5
|
|
6
6
|
attr_accessor :mode
|
7
7
|
|
8
|
-
attr_reader :
|
8
|
+
attr_reader :daemonize, :pluginconf, :libdir, :configured
|
9
9
|
attr_reader :logfile, :keeplogs, :max_log_size, :loglevel, :logfacility
|
10
10
|
attr_reader :identity, :daemonize, :connector, :securityprovider, :factsource
|
11
|
-
attr_reader :registration, :registerinterval, :
|
11
|
+
attr_reader :registration, :registerinterval, :classesfile
|
12
12
|
attr_reader :rpcauditprovider, :rpcaudit, :configdir, :rpcauthprovider
|
13
|
-
attr_reader :rpcauthorization, :color, :configfile
|
13
|
+
attr_reader :rpcauthorization, :color, :configfile
|
14
14
|
attr_reader :rpclimitmethod, :logger_type, :fact_cache_time, :collectives
|
15
15
|
attr_reader :main_collective, :ssl_cipher, :registration_collective
|
16
|
-
attr_reader :direct_addressing, :direct_addressing_threshold, :ttl
|
17
|
-
attr_reader :
|
16
|
+
attr_reader :direct_addressing, :direct_addressing_threshold, :ttl
|
17
|
+
attr_reader :default_discovery_method, :default_discovery_options
|
18
|
+
attr_reader :publish_timeout, :threaded
|
18
19
|
|
19
20
|
def initialize
|
20
21
|
@configured = false
|
@@ -24,39 +25,34 @@ module MCollective
|
|
24
25
|
set_config_defaults(configfile)
|
25
26
|
|
26
27
|
if File.exists?(configfile)
|
27
|
-
File.
|
28
|
+
File.readlines(configfile).each do |line|
|
28
29
|
|
29
30
|
# strip blank spaces, tabs etc off the end of all lines
|
30
31
|
line.gsub!(/\s*$/, "")
|
31
32
|
|
32
33
|
unless line =~ /^#|^$/
|
33
34
|
if (line =~ /(.+?)\s*=\s*(.+)/)
|
34
|
-
key = $1
|
35
|
+
key = $1.strip
|
35
36
|
val = $2
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
@topicsep = val
|
38
|
+
begin
|
39
|
+
case key
|
40
40
|
when "registration"
|
41
41
|
@registration = val.capitalize
|
42
42
|
when "registration_collective"
|
43
43
|
@registration_collective = val
|
44
44
|
when "registerinterval"
|
45
|
-
@registerinterval = val
|
45
|
+
@registerinterval = Integer(val)
|
46
46
|
when "collectives"
|
47
47
|
@collectives = val.split(",").map {|c| c.strip}
|
48
48
|
when "main_collective"
|
49
49
|
@main_collective = val
|
50
|
-
when "topicprefix"
|
51
|
-
@topicprefix = val
|
52
|
-
when "queueprefix"
|
53
|
-
@queueprefix = val
|
54
50
|
when "logfile"
|
55
51
|
@logfile = val
|
56
52
|
when "keeplogs"
|
57
|
-
@keeplogs = val
|
53
|
+
@keeplogs = Integer(val)
|
58
54
|
when "max_log_size"
|
59
|
-
@max_log_size = val
|
55
|
+
@max_log_size = Integer(val)
|
60
56
|
when "loglevel"
|
61
57
|
@loglevel = val
|
62
58
|
when "logfacility"
|
@@ -64,6 +60,8 @@ module MCollective
|
|
64
60
|
when "libdir"
|
65
61
|
paths = val.split(File::PATH_SEPARATOR)
|
66
62
|
paths.each do |path|
|
63
|
+
raise("libdir paths should be absolute paths but '%s' is relative" % path) unless Util.absolute_path?(path)
|
64
|
+
|
67
65
|
@libdir << path
|
68
66
|
unless $LOAD_PATH.include?(path)
|
69
67
|
$LOAD_PATH << path
|
@@ -72,13 +70,13 @@ module MCollective
|
|
72
70
|
when "identity"
|
73
71
|
@identity = val
|
74
72
|
when "direct_addressing"
|
75
|
-
|
73
|
+
@direct_addressing = Util.str_to_bool(val)
|
76
74
|
when "direct_addressing_threshold"
|
77
|
-
@direct_addressing_threshold = val
|
75
|
+
@direct_addressing_threshold = Integer(val)
|
78
76
|
when "color"
|
79
|
-
|
77
|
+
@color = Util.str_to_bool(val)
|
80
78
|
when "daemonize"
|
81
|
-
|
79
|
+
@daemonize = Util.str_to_bool(val)
|
82
80
|
when "securityprovider"
|
83
81
|
@securityprovider = val.capitalize
|
84
82
|
when "factsource"
|
@@ -89,39 +87,46 @@ module MCollective
|
|
89
87
|
@classesfile = val
|
90
88
|
when /^plugin.(.+)$/
|
91
89
|
@pluginconf[$1] = val
|
90
|
+
when "publish_timeout"
|
91
|
+
@publish_timeout = Integer(val)
|
92
92
|
when "rpcaudit"
|
93
|
-
|
93
|
+
@rpcaudit = Util.str_to_bool(val)
|
94
94
|
when "rpcauditprovider"
|
95
95
|
@rpcauditprovider = val.capitalize
|
96
96
|
when "rpcauthorization"
|
97
|
-
|
97
|
+
@rpcauthorization = Util.str_to_bool(val)
|
98
98
|
when "rpcauthprovider"
|
99
99
|
@rpcauthprovider = val.capitalize
|
100
|
-
when "rpchelptemplate"
|
101
|
-
@rpchelptemplate = val
|
102
100
|
when "rpclimitmethod"
|
103
101
|
@rpclimitmethod = val.to_sym
|
104
102
|
when "logger_type"
|
105
103
|
@logger_type = val
|
106
104
|
when "fact_cache_time"
|
107
|
-
@fact_cache_time = val
|
105
|
+
@fact_cache_time = Integer(val)
|
108
106
|
when "ssl_cipher"
|
109
107
|
@ssl_cipher = val
|
108
|
+
when "threaded"
|
109
|
+
@threaded = Util.str_to_bool(val)
|
110
110
|
when "ttl"
|
111
|
-
@ttl = val
|
112
|
-
when "helptemplatedir"
|
113
|
-
@helptemplatedir = val
|
111
|
+
@ttl = Integer(val)
|
114
112
|
when "default_discovery_options"
|
115
113
|
@default_discovery_options << val
|
116
114
|
when "default_discovery_method"
|
117
115
|
@default_discovery_method = val
|
116
|
+
when "topicprefix", "topicsep", "queueprefix", "rpchelptemplate", "helptemplatedir"
|
117
|
+
Log.warn("Use of deprecated '#{key}' option. This option is ignored and should be removed from '#{configfile}'")
|
118
118
|
else
|
119
|
-
raise("Unknown config parameter #{key}")
|
119
|
+
raise("Unknown config parameter '#{key}'")
|
120
|
+
end
|
121
|
+
rescue ArgumentError => e
|
122
|
+
raise "Could not parse value for configuration option '#{key}' with value '#{val}'"
|
120
123
|
end
|
121
124
|
end
|
122
125
|
end
|
123
126
|
end
|
124
127
|
|
128
|
+
raise('The %s config file does not specify a libdir setting, cannot continue' % configfile) if @libdir.empty?
|
129
|
+
|
125
130
|
read_plugin_config_dir("#{@configdir}/plugin.d")
|
126
131
|
|
127
132
|
raise 'Identities can only match /\w\.\-/' unless @identity.match(/^[\w\.\-]+$/)
|
@@ -140,6 +145,8 @@ module MCollective
|
|
140
145
|
PluginManager.loadclass("Mcollective::Registration::#{@registration}")
|
141
146
|
PluginManager.loadclass("Mcollective::Audit::#{@rpcauditprovider}") if @rpcaudit
|
142
147
|
PluginManager << {:type => "global_stats", :class => RunnerStats.new}
|
148
|
+
|
149
|
+
Log.info("The Marionette Collective version #{MCollective::VERSION} started by #{$0} using config file #{configfile}")
|
143
150
|
else
|
144
151
|
raise("Cannot find config file '#{configfile}'")
|
145
152
|
end
|
@@ -149,16 +156,13 @@ module MCollective
|
|
149
156
|
@stomp = Hash.new
|
150
157
|
@subscribe = Array.new
|
151
158
|
@pluginconf = Hash.new
|
152
|
-
@connector = "
|
159
|
+
@connector = "activemq"
|
153
160
|
@securityprovider = "Psk"
|
154
161
|
@factsource = "Yaml"
|
155
162
|
@identity = Socket.gethostname
|
156
163
|
@registration = "Agentlist"
|
157
164
|
@registerinterval = 0
|
158
165
|
@registration_collective = nil
|
159
|
-
@topicsep = "."
|
160
|
-
@topicprefix = "/topic/"
|
161
|
-
@queueprefix = "/queue/"
|
162
166
|
@classesfile = "/var/lib/puppet/state/classes.txt"
|
163
167
|
@rpcaudit = false
|
164
168
|
@rpcauditprovider = ""
|
@@ -178,19 +182,14 @@ module MCollective
|
|
178
182
|
@collectives = ["mcollective"]
|
179
183
|
@main_collective = @collectives.first
|
180
184
|
@ssl_cipher = "aes-256-cbc"
|
181
|
-
@direct_addressing =
|
185
|
+
@direct_addressing = true
|
182
186
|
@direct_addressing_threshold = 10
|
183
187
|
@default_discovery_method = "mc"
|
184
188
|
@default_discovery_options = []
|
185
189
|
@ttl = 60
|
186
190
|
@mode = :client
|
187
|
-
|
188
|
-
|
189
|
-
# with odd paths will just work more often, but fall back to old behavior if it does
|
190
|
-
# not exist
|
191
|
-
@rpchelptemplate = File.join(File.dirname(configfile), "rpc-help.erb")
|
192
|
-
@rpchelptemplate = "/etc/mcollective/rpc-help.erb" unless File.exists?(@rpchelptemplate)
|
193
|
-
@helptemplatedir = File.dirname(@rpchelptemplate)
|
191
|
+
@publish_timeout = 2
|
192
|
+
@threaded = false
|
194
193
|
end
|
195
194
|
|
196
195
|
def read_plugin_config_dir(dir)
|
@@ -205,7 +204,7 @@ module MCollective
|
|
205
204
|
line.gsub!(/\s*$/, "")
|
206
205
|
next if line =~ /^#|^$/
|
207
206
|
if (line =~ /(.+?)\s*=\s*(.+)/)
|
208
|
-
key = $1
|
207
|
+
key = $1.strip
|
209
208
|
val = $2
|
210
209
|
@pluginconf["#{plugin}.#{key}"] = val
|
211
210
|
end
|