choria-mcorpc-support 2.23.0 → 2.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/mcollective.rb +3 -3
- data/lib/mcollective/agent/bolt_tasks.ddl +18 -0
- data/lib/mcollective/agent/bolt_tasks.json +18 -0
- data/lib/mcollective/agent/bolt_tasks.rb +4 -2
- data/lib/mcollective/agent/rpcutil.ddl +2 -2
- data/lib/mcollective/agent/rpcutil.json +2 -2
- data/lib/mcollective/application/choria.rb +3 -63
- data/lib/mcollective/application/facts.rb +2 -67
- data/lib/mcollective/application/federation.rb +1 -3
- data/lib/mcollective/application/find.rb +1 -1
- data/lib/mcollective/application/ping.rb +31 -3
- data/lib/mcollective/application/plugin.rb +2 -15
- data/lib/mcollective/application/tasks.rb +9 -0
- data/lib/mcollective/client.rb +1 -1
- data/lib/mcollective/config.rb +135 -103
- data/lib/mcollective/ddl.rb +0 -1
- data/lib/mcollective/discovery.rb +12 -65
- data/lib/mcollective/discovery/broadcast.ddl +11 -0
- data/lib/mcollective/discovery/choria.ddl +6 -4
- data/lib/mcollective/discovery/delegate.ddl +13 -0
- data/lib/mcollective/discovery/delegate.rb +73 -0
- data/lib/mcollective/discovery/external.ddl +13 -0
- data/lib/mcollective/discovery/file.ddl +13 -0
- data/lib/mcollective/discovery/flatfile.ddl +7 -5
- data/lib/mcollective/discovery/inventory.ddl +13 -0
- data/lib/mcollective/discovery/mc.ddl +3 -3
- data/lib/mcollective/generators.rb +0 -1
- data/lib/mcollective/message.rb +0 -24
- data/lib/mcollective/optionparser.rb +2 -2
- data/lib/mcollective/pluginpackager/forge_packager.rb +1 -1
- data/lib/mcollective/rpc/client.rb +6 -4
- data/lib/mcollective/security/base.rb +1 -37
- data/lib/mcollective/util.rb +23 -31
- data/lib/mcollective/util/choria.rb +0 -157
- data/lib/mcollective/util/tasks_support.rb +22 -3
- metadata +9 -27
- data/lib/mcollective/application/describe_filter.rb +0 -87
- data/lib/mcollective/data.rb +0 -96
- data/lib/mcollective/data/agent_data.ddl +0 -22
- data/lib/mcollective/data/agent_data.rb +0 -17
- data/lib/mcollective/data/base.rb +0 -68
- data/lib/mcollective/data/bolt_task_data.ddl +0 -90
- data/lib/mcollective/data/bolt_task_data.rb +0 -32
- data/lib/mcollective/data/collective_data.ddl +0 -20
- data/lib/mcollective/data/collective_data.rb +0 -9
- data/lib/mcollective/data/fact_data.ddl +0 -28
- data/lib/mcollective/data/fact_data.rb +0 -55
- data/lib/mcollective/data/fstat_data.ddl +0 -89
- data/lib/mcollective/data/fstat_data.rb +0 -54
- data/lib/mcollective/data/result.rb +0 -50
- data/lib/mcollective/ddl/dataddl.rb +0 -56
- data/lib/mcollective/discovery/choria.rb +0 -223
- data/lib/mcollective/discovery/flatfile.rb +0 -47
- data/lib/mcollective/discovery/stdin.ddl +0 -11
- data/lib/mcollective/discovery/stdin.rb +0 -67
- data/lib/mcollective/generators/data_generator.rb +0 -50
- data/lib/mcollective/generators/templates/data_input_snippet.erb +0 -7
- data/lib/mcollective/matcher.rb +0 -220
- data/lib/mcollective/matcher/parser.rb +0 -118
- data/lib/mcollective/matcher/scanner.rb +0 -236
@@ -250,8 +250,9 @@ module MCollective
|
|
250
250
|
# @param environment [Hash] environment to run with
|
251
251
|
# @param stdin [String] stdin to send to the command
|
252
252
|
# @param spooldir [String] path to the spool for this specific request
|
253
|
+
# @param run_as [String] name of the user who will run the command
|
253
254
|
# @return [Integer] the pid that was spawned
|
254
|
-
def spawn_command(command, environment, stdin, spooldir)
|
255
|
+
def spawn_command(command, environment, stdin, spooldir, run_as)
|
255
256
|
wrapper_input = File.join(spooldir, "wrapper_stdin")
|
256
257
|
wrapper_stdout = File.join(spooldir, "wrapper_stdout")
|
257
258
|
wrapper_stderr = File.join(spooldir, "wrapper_stderr")
|
@@ -269,7 +270,25 @@ module MCollective
|
|
269
270
|
options[:in] = wrapper_input
|
270
271
|
end
|
271
272
|
|
272
|
-
|
273
|
+
if run_as
|
274
|
+
raise("System does not allow forking. run_as not usable.") unless Process.respond_to?(:fork)
|
275
|
+
|
276
|
+
require "etc"
|
277
|
+
|
278
|
+
u = Etc.getpwnam(run_as)
|
279
|
+
|
280
|
+
FileUtils.chown_R(u.uid, u.gid, spooldir)
|
281
|
+
|
282
|
+
pid = Process.fork
|
283
|
+
if pid.nil?
|
284
|
+
Process.gid = Process.egid = u.gid
|
285
|
+
Process.uid = Process.euid = u.uid
|
286
|
+
ENV.delete_if { |name| name !~ /^LC_/ }
|
287
|
+
Process.exec(environment, command, options)
|
288
|
+
end
|
289
|
+
else
|
290
|
+
pid = Process.spawn(environment, command, options)
|
291
|
+
end
|
273
292
|
|
274
293
|
sleep 0.1 until File.exist?(wrapper_stdout)
|
275
294
|
|
@@ -353,7 +372,7 @@ module MCollective
|
|
353
372
|
meta.print(data.to_json)
|
354
373
|
end
|
355
374
|
|
356
|
-
pid = spawn_command(wrapper_path, task_environment(task, requestid, callerid), wrapper_input.to_json, spool)
|
375
|
+
pid = spawn_command(wrapper_path, task_environment(task, requestid, callerid), wrapper_input.to_json, spool, task["run_as"])
|
357
376
|
|
358
377
|
Log.info("Spawned task %s in spool %s with pid %s" % [task["task"], spool, pid])
|
359
378
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: choria-mcorpc-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.24.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- R.I.Pienaar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- lib/mcollective/application.rb
|
80
80
|
- lib/mcollective/application/choria.rb
|
81
81
|
- lib/mcollective/application/completion.rb
|
82
|
-
- lib/mcollective/application/describe_filter.rb
|
83
82
|
- lib/mcollective/application/facts.rb
|
84
83
|
- lib/mcollective/application/federation.rb
|
85
84
|
- lib/mcollective/application/find.rb
|
@@ -99,34 +98,22 @@ files:
|
|
99
98
|
- lib/mcollective/connector/base.rb
|
100
99
|
- lib/mcollective/connector/nats.ddl
|
101
100
|
- lib/mcollective/connector/nats.rb
|
102
|
-
- lib/mcollective/data.rb
|
103
|
-
- lib/mcollective/data/agent_data.ddl
|
104
|
-
- lib/mcollective/data/agent_data.rb
|
105
|
-
- lib/mcollective/data/base.rb
|
106
|
-
- lib/mcollective/data/bolt_task_data.ddl
|
107
|
-
- lib/mcollective/data/bolt_task_data.rb
|
108
|
-
- lib/mcollective/data/collective_data.ddl
|
109
|
-
- lib/mcollective/data/collective_data.rb
|
110
|
-
- lib/mcollective/data/fact_data.ddl
|
111
|
-
- lib/mcollective/data/fact_data.rb
|
112
|
-
- lib/mcollective/data/fstat_data.ddl
|
113
|
-
- lib/mcollective/data/fstat_data.rb
|
114
|
-
- lib/mcollective/data/result.rb
|
115
101
|
- lib/mcollective/ddl.rb
|
116
102
|
- lib/mcollective/ddl/agentddl.rb
|
117
103
|
- lib/mcollective/ddl/base.rb
|
118
|
-
- lib/mcollective/ddl/dataddl.rb
|
119
104
|
- lib/mcollective/ddl/discoveryddl.rb
|
120
105
|
- lib/mcollective/ddl/validatorddl.rb
|
121
106
|
- lib/mcollective/discovery.rb
|
107
|
+
- lib/mcollective/discovery/broadcast.ddl
|
122
108
|
- lib/mcollective/discovery/choria.ddl
|
123
|
-
- lib/mcollective/discovery/
|
109
|
+
- lib/mcollective/discovery/delegate.ddl
|
110
|
+
- lib/mcollective/discovery/delegate.rb
|
111
|
+
- lib/mcollective/discovery/external.ddl
|
112
|
+
- lib/mcollective/discovery/file.ddl
|
124
113
|
- lib/mcollective/discovery/flatfile.ddl
|
125
|
-
- lib/mcollective/discovery/
|
114
|
+
- lib/mcollective/discovery/inventory.ddl
|
126
115
|
- lib/mcollective/discovery/mc.ddl
|
127
116
|
- lib/mcollective/discovery/mc.rb
|
128
|
-
- lib/mcollective/discovery/stdin.ddl
|
129
|
-
- lib/mcollective/discovery/stdin.rb
|
130
117
|
- lib/mcollective/exceptions.rb
|
131
118
|
- lib/mcollective/facts.rb
|
132
119
|
- lib/mcollective/facts/base.rb
|
@@ -134,9 +121,7 @@ files:
|
|
134
121
|
- lib/mcollective/generators.rb
|
135
122
|
- lib/mcollective/generators/agent_generator.rb
|
136
123
|
- lib/mcollective/generators/base.rb
|
137
|
-
- lib/mcollective/generators/data_generator.rb
|
138
124
|
- lib/mcollective/generators/templates/action_snippet.erb
|
139
|
-
- lib/mcollective/generators/templates/data_input_snippet.erb
|
140
125
|
- lib/mcollective/generators/templates/ddl.erb
|
141
126
|
- lib/mcollective/generators/templates/plugin.erb
|
142
127
|
- lib/mcollective/log.rb
|
@@ -145,9 +130,6 @@ files:
|
|
145
130
|
- lib/mcollective/logger/console_logger.rb
|
146
131
|
- lib/mcollective/logger/file_logger.rb
|
147
132
|
- lib/mcollective/logger/syslog_logger.rb
|
148
|
-
- lib/mcollective/matcher.rb
|
149
|
-
- lib/mcollective/matcher/parser.rb
|
150
|
-
- lib/mcollective/matcher/scanner.rb
|
151
133
|
- lib/mcollective/message.rb
|
152
134
|
- lib/mcollective/monkey_patches.rb
|
153
135
|
- lib/mcollective/optionparser.rb
|
@@ -259,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
241
|
version: '0'
|
260
242
|
requirements: []
|
261
243
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.6.
|
244
|
+
rubygems_version: 2.7.6.2
|
263
245
|
signing_key:
|
264
246
|
specification_version: 4
|
265
247
|
summary: Support libraries the Choria Server
|
@@ -1,87 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
class Application::Describe_filter < Application # rubocop:disable Style/ClassAndModuleChildren
|
3
|
-
exclude_argument_sections "common", "rpc"
|
4
|
-
|
5
|
-
description "Display human readable interpretation of filters"
|
6
|
-
|
7
|
-
usage "mco describe_filter -S <filter> -F <filter> -C <filter>"
|
8
|
-
|
9
|
-
def describe_s_filter(stack)
|
10
|
-
indent = " "
|
11
|
-
old_indent = " "
|
12
|
-
puts "-S Query expands to the following instructions:"
|
13
|
-
puts
|
14
|
-
stack.each do |token|
|
15
|
-
case token.keys[0]
|
16
|
-
when "statement"
|
17
|
-
if token.values[0] =~ /(<=|>=|=|=~|=)/
|
18
|
-
op = $1
|
19
|
-
k, v = token.values[0].split(op)
|
20
|
-
puts indent + get_fact_string(k, v, op)
|
21
|
-
else
|
22
|
-
puts indent + get_class_string(token.values[0])
|
23
|
-
end
|
24
|
-
when "fstatement"
|
25
|
-
v = token.values[0]
|
26
|
-
result_string = indent + "Execute the Data Query '#{v['name']}'"
|
27
|
-
result_string += " with parameters (#{v['params']})" if v["params"]
|
28
|
-
result_string += ". "
|
29
|
-
result_string += "Check if the query's '#{v['value']}' value #{v['operator']} '#{v['r_compare']}' "
|
30
|
-
puts result_string
|
31
|
-
when "("
|
32
|
-
puts "#{indent}("
|
33
|
-
old_indent = indent
|
34
|
-
indent *= 2
|
35
|
-
when ")"
|
36
|
-
indent = old_indent
|
37
|
-
puts "#{indent})"
|
38
|
-
else
|
39
|
-
puts indent + token.keys[0].upcase
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def describe_f_filter(facts)
|
45
|
-
puts "-F filter expands to the following fact comparisons:"
|
46
|
-
puts
|
47
|
-
facts.each do |f|
|
48
|
-
puts " #{get_fact_string(f[:fact], f[:value], f[:operator])}"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def describe_c_filter(classes)
|
53
|
-
puts "-C filter expands to the following class checks:"
|
54
|
-
puts
|
55
|
-
classes.each do |c|
|
56
|
-
puts " #{get_class_string(c)}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def main
|
61
|
-
unless @options[:filter]["fact"].empty?
|
62
|
-
describe_f_filter(@options[:filter]["fact"])
|
63
|
-
puts
|
64
|
-
end
|
65
|
-
|
66
|
-
unless @options[:filter]["cf_class"].empty?
|
67
|
-
describe_c_filter(@options[:filter]["cf_class"])
|
68
|
-
puts
|
69
|
-
end
|
70
|
-
|
71
|
-
unless @options[:filter]["compound"].empty?
|
72
|
-
describe_s_filter(@options[:filter]["compound"][0])
|
73
|
-
puts
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
def get_fact_string(fact, value, oper)
|
80
|
-
"Check if fact '#{fact}' #{oper} '#{value}'"
|
81
|
-
end
|
82
|
-
|
83
|
-
def get_class_string(classname)
|
84
|
-
"Check if class '#{classname}' is present on the host"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/lib/mcollective/data.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module Data
|
3
|
-
require "mcollective/data/base"
|
4
|
-
require "mcollective/data/result"
|
5
|
-
|
6
|
-
def self.load_data_sources
|
7
|
-
PluginManager.find_and_load("data")
|
8
|
-
|
9
|
-
PluginManager.grep(/_data$/).each do |plugin|
|
10
|
-
begin
|
11
|
-
unless PluginManager[plugin].class.activate?
|
12
|
-
Log.debug("Disabling data plugin %s due to plugin activation policy" % plugin)
|
13
|
-
PluginManager.delete(plugin)
|
14
|
-
end
|
15
|
-
rescue Exception => e # rubocop:disable Lint/RescueException
|
16
|
-
Log.debug("Disabling data plugin %s due to exception %s: %s" % [plugin, e.class, e])
|
17
|
-
PluginManager.delete(plugin)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.pluginname(plugin)
|
23
|
-
plugin.to_s =~ /_data$/i ? plugin.to_s.downcase : "%s_data" % plugin.to_s.downcase
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.[](plugin)
|
27
|
-
PluginManager[pluginname(plugin)]
|
28
|
-
end
|
29
|
-
|
30
|
-
# Data.package("httpd").architecture
|
31
|
-
def self.method_missing(method, *args)
|
32
|
-
super unless PluginManager.include?(pluginname(method))
|
33
|
-
|
34
|
-
PluginManager[pluginname(method)].lookup(args.first)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.respond_to_missing?(method, *)
|
38
|
-
PluginManager.include?(pluginname(method)) || super
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.ddl(plugin)
|
42
|
-
DDL.new(pluginname(plugin), :data)
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.ddl_validate(ddl, argument)
|
46
|
-
name = ddl.meta[:name]
|
47
|
-
query = ddl.entities[:data]
|
48
|
-
|
49
|
-
raise DDLValidationError, "No dataquery has been defined in the DDL for data plugin #{name}" unless query
|
50
|
-
|
51
|
-
input = query.fetch(:input, {})
|
52
|
-
output = query.fetch(:output, {})
|
53
|
-
|
54
|
-
raise DDLValidationError, "No output has been defined in the DDL for data plugin #{name}" if output.keys.empty?
|
55
|
-
|
56
|
-
if input[:query]
|
57
|
-
return true if argument.nil? && input[:query][:optional]
|
58
|
-
|
59
|
-
ddl.validate_input_argument(input, :query, argument)
|
60
|
-
else
|
61
|
-
raise("No data plugin argument was declared in the %s DDL but an input was supplied" % name) if argument
|
62
|
-
|
63
|
-
true
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.ddl_has_output?(ddl, output)
|
68
|
-
ddl.entities[:data][:output].include?(output.to_sym) rescue false
|
69
|
-
end
|
70
|
-
|
71
|
-
# For an input where the DDL requests a boolean or some number
|
72
|
-
# this will convert the input to the right type where possible
|
73
|
-
# else just returns the origin input unedited
|
74
|
-
#
|
75
|
-
# if anything here goes wrong just return the input value
|
76
|
-
# this is not really the end of the world or anything since
|
77
|
-
# all that will happen is that DDL validation will fail and
|
78
|
-
# the user will get an error, no need to be too defensive here
|
79
|
-
def self.ddl_transform_input(ddl, input)
|
80
|
-
begin
|
81
|
-
type = ddl.entities[:data][:input][:query][:type]
|
82
|
-
|
83
|
-
case type
|
84
|
-
when :boolean
|
85
|
-
return DDL.string_to_boolean(input)
|
86
|
-
|
87
|
-
when :number, :integer, :float
|
88
|
-
return DDL.string_to_number(input)
|
89
|
-
end
|
90
|
-
rescue # rubocop:disable Lint/SuppressedException
|
91
|
-
end
|
92
|
-
|
93
|
-
input
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
metadata :name => "Agent",
|
2
|
-
:description => "Meta data about installed MColletive Agents",
|
3
|
-
:author => "R.I.Pienaar <rip@devco.net>",
|
4
|
-
:license => "ASL 2.0",
|
5
|
-
:version => "1.0",
|
6
|
-
:url => "https://docs.puppetlabs.com/mcollective/",
|
7
|
-
:timeout => 1
|
8
|
-
|
9
|
-
dataquery :description => "Agent Meta Data" do
|
10
|
-
input :query,
|
11
|
-
:prompt => "Agent Name",
|
12
|
-
:description => "Valid agent name",
|
13
|
-
:type => :string,
|
14
|
-
:validation => /^[\w\_]+$/,
|
15
|
-
:maxlength => 20
|
16
|
-
|
17
|
-
[:license, :timeout, :description, :url, :version, :author].each do |item|
|
18
|
-
output item,
|
19
|
-
:description => "Agent #{item}",
|
20
|
-
:display_as => item.to_s.capitalize
|
21
|
-
end
|
22
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module Data
|
3
|
-
class Agent_data < Base
|
4
|
-
query do |plugin|
|
5
|
-
raise "No agent called #{plugin} found" unless PluginManager.include?("#{plugin}_agent")
|
6
|
-
|
7
|
-
agent = PluginManager["#{plugin}_agent"]
|
8
|
-
|
9
|
-
result[:agent] = plugin
|
10
|
-
|
11
|
-
[:license, :timeout, :description, :url, :version, :author].each do |item|
|
12
|
-
result[item] = agent.meta[item]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module Data
|
3
|
-
class Base
|
4
|
-
attr_reader :name, :result, :ddl, :timeout
|
5
|
-
|
6
|
-
# Register plugins that inherits base
|
7
|
-
def self.inherited(klass)
|
8
|
-
type = klass.to_s.split("::").last.downcase
|
9
|
-
|
10
|
-
PluginManager << {:type => type, :class => klass.to_s, :single_instance => false}
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@name = self.class.to_s.split("::").last.downcase
|
16
|
-
@ddl = DDL.new(@name, :data)
|
17
|
-
@result = Result.new(@ddl.dataquery_interface[:output])
|
18
|
-
@timeout = @ddl.meta[:timeout] || 1
|
19
|
-
|
20
|
-
startup_hook
|
21
|
-
end
|
22
|
-
|
23
|
-
def lookup(what)
|
24
|
-
ddl_validate(what)
|
25
|
-
|
26
|
-
Log.debug("Doing data query %s for '%s'" % [@name, what])
|
27
|
-
|
28
|
-
Timeout.timeout(@timeout) do
|
29
|
-
query_data(what)
|
30
|
-
end
|
31
|
-
|
32
|
-
@result
|
33
|
-
rescue Timeout::Error
|
34
|
-
# Timeout::Error is a inherited from Interrupt which seems a really
|
35
|
-
# strange choice, making it an equivelant of ^C and such. Catch it
|
36
|
-
# and raise something less critical that will not the runner to just
|
37
|
-
# give up the ghost
|
38
|
-
msg = "Data plugin %s timed out on query '%s'" % [@name, what]
|
39
|
-
Log.error(msg)
|
40
|
-
raise MsgTTLExpired, msg
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.query(&block)
|
44
|
-
module_eval { define_method("query_data", &block) }
|
45
|
-
end
|
46
|
-
|
47
|
-
def ddl_validate(what)
|
48
|
-
Data.ddl_validate(@ddl, what)
|
49
|
-
end
|
50
|
-
|
51
|
-
# activate_when do
|
52
|
-
# file.exist?("/usr/bin/puppet")
|
53
|
-
# end
|
54
|
-
def self.activate_when(&block)
|
55
|
-
(class << self; self; end).instance_eval do
|
56
|
-
define_method("activate?", &block)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Always be active unless a specific block is given with activate_when
|
61
|
-
def self.activate?
|
62
|
-
true
|
63
|
-
end
|
64
|
-
|
65
|
-
def startup_hook; end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
metadata :name => "bolt_task",
|
2
|
-
:description => "Information about past Bolt Task",
|
3
|
-
:author => "R.I.Pienaar <rip@devco.net>",
|
4
|
-
:license => "Apache-2.0",
|
5
|
-
:version => "0.19.0",
|
6
|
-
:url => "https://choria.io",
|
7
|
-
:timeout => 1
|
8
|
-
|
9
|
-
usage <<-EOU
|
10
|
-
This data plugin let you extract information about a previously
|
11
|
-
run Bolt Task for use in discovery and elsewhere.
|
12
|
-
|
13
|
-
To run a task on nodes where one previously failed:
|
14
|
-
|
15
|
-
mco tasks run myapp::update -S "bolt_task('ae561842dc7d5a9dae94f766dfb3d4c8').exitcode > 0"
|
16
|
-
EOU
|
17
|
-
|
18
|
-
dataquery :description => "Puppet Bolt Task state" do
|
19
|
-
input :query,
|
20
|
-
:prompt => "Task ID",
|
21
|
-
:description => "The Task ID to retrieve",
|
22
|
-
:type => :string,
|
23
|
-
:validation => '^[a-z,0-9]{32}$',
|
24
|
-
:maxlength => 32
|
25
|
-
|
26
|
-
output :known,
|
27
|
-
:description => "If this is a known task on this node",
|
28
|
-
:display_as => "Known Task",
|
29
|
-
:default => false
|
30
|
-
|
31
|
-
output :spool,
|
32
|
-
:description => "Where on disk the task status is stored",
|
33
|
-
:display_as => "Spool",
|
34
|
-
:default => ""
|
35
|
-
|
36
|
-
output :task,
|
37
|
-
:description => "The name of the task that was run",
|
38
|
-
:display_as => "Task",
|
39
|
-
:default => ""
|
40
|
-
|
41
|
-
output :caller,
|
42
|
-
:description => "The user who invoked the task",
|
43
|
-
:display_as => "Invoked by",
|
44
|
-
:default => ""
|
45
|
-
|
46
|
-
output :stdout,
|
47
|
-
:description => "The STDOUT output from the task",
|
48
|
-
:display_as => "STDOUT",
|
49
|
-
:default => ""
|
50
|
-
|
51
|
-
output :stderr,
|
52
|
-
:description => "The STDERR output from the task",
|
53
|
-
:display_as => "STDERR",
|
54
|
-
:default => ""
|
55
|
-
|
56
|
-
output :exitcode,
|
57
|
-
:description => "The exitcode from the task",
|
58
|
-
:display_as => "Exit Code",
|
59
|
-
:default => 127
|
60
|
-
|
61
|
-
output :runtime,
|
62
|
-
:description => "How long the task took to run",
|
63
|
-
:display_as => "Runtime",
|
64
|
-
:default => 0.0
|
65
|
-
|
66
|
-
output :start_time,
|
67
|
-
:description => "When the task was started, seconds since 1970 in UTC time",
|
68
|
-
:display_as => "Start Time",
|
69
|
-
:default => 0
|
70
|
-
|
71
|
-
output :wrapper_spawned,
|
72
|
-
:description => "Did the wrapper start successfully",
|
73
|
-
:display_as => "Wrapper Spawned",
|
74
|
-
:default => false
|
75
|
-
|
76
|
-
output :wrapper_error,
|
77
|
-
:description => "Error output from the wrapper command",
|
78
|
-
:display_as => "Wrapper Error",
|
79
|
-
:default => ""
|
80
|
-
|
81
|
-
output :wrapper_pid,
|
82
|
-
:description => "The PID of the wrapper that runs the task",
|
83
|
-
:display_as => "Wrapper PID",
|
84
|
-
:default => -1
|
85
|
-
|
86
|
-
output :completed,
|
87
|
-
:description => "Did the task complete running",
|
88
|
-
:display_as => "Completed",
|
89
|
-
:default => false
|
90
|
-
end
|