choria-mcorpc-support 2.23.3 → 2.24.4
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/choria_provision.ddl +214 -0
- data/lib/mcollective/agent/choria_provision.json +272 -0
- data/lib/mcollective/agent/choria_util.ddl +226 -107
- data/lib/mcollective/agent/choria_util.json +125 -25
- data/lib/mcollective/agent/rpcutil.ddl +242 -183
- data/lib/mcollective/agent/rpcutil.json +53 -57
- data/lib/mcollective/agent/scout.ddl +1 -1
- data/lib/mcollective/agent/scout.json +108 -136
- data/lib/mcollective/application/find.rb +1 -1
- data/lib/mcollective/application/plugin.rb +8 -173
- data/lib/mcollective/client.rb +1 -1
- data/lib/mcollective/config.rb +145 -103
- data/lib/mcollective/ddl.rb +0 -1
- data/lib/mcollective/discovery.rb +11 -63
- 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 +72 -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/log.rb +1 -2
- data/lib/mcollective/optionparser.rb +1 -1
- data/lib/mcollective/pluginpackager/forge_packager.rb +1 -1
- data/lib/mcollective/rpc/client.rb +4 -2
- data/lib/mcollective/util.rb +2 -4
- data/lib/mcollective/util/choria.rb +14 -8
- data/lib/mcollective/util/tasks_support.rb +15 -2
- metadata +11 -29
- 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.rb +0 -7
- data/lib/mcollective/generators/agent_generator.rb +0 -50
- data/lib/mcollective/generators/base.rb +0 -45
- data/lib/mcollective/generators/data_generator.rb +0 -50
- data/lib/mcollective/generators/templates/action_snippet.erb +0 -13
- data/lib/mcollective/generators/templates/data_input_snippet.erb +0 -7
- data/lib/mcollective/generators/templates/ddl.erb +0 -8
- data/lib/mcollective/generators/templates/plugin.erb +0 -7
@@ -157,7 +157,7 @@ module MCollective
|
|
157
157
|
# @return [String] path to the command
|
158
158
|
def task_command(spooldir, task)
|
159
159
|
file_spec = task["files"][0]
|
160
|
-
file_name = File.join(spooldir, "files", file_spec["filename"])
|
160
|
+
file_name = File.join(spooldir, "files", task_module(task["task"]), "tasks", file_spec["filename"])
|
161
161
|
|
162
162
|
command = platform_specific_command(file_name)
|
163
163
|
|
@@ -186,6 +186,7 @@ module MCollective
|
|
186
186
|
environment["PT_%s" % k] = v.to_s
|
187
187
|
end
|
188
188
|
|
189
|
+
environment["PT__task"] = task["task"]
|
189
190
|
environment["PT__installdir"] = File.join(request_spooldir(task_id), "files")
|
190
191
|
|
191
192
|
environment
|
@@ -220,7 +221,10 @@ module MCollective
|
|
220
221
|
# @param task [Hash] task specification
|
221
222
|
def populate_spooldir(spooldir, task)
|
222
223
|
task["files"].each do |file|
|
223
|
-
|
224
|
+
filename = file["filename"]
|
225
|
+
filename = File.join(task_module(task["task"]), "tasks", filename) unless filename.index("/")
|
226
|
+
|
227
|
+
spool_filename = File.join(spooldir, "files", filename)
|
224
228
|
|
225
229
|
FileUtils.mkdir_p(File.dirname(spool_filename), :mode => 0o0750)
|
226
230
|
FileUtils.cp(task_file_name(file), spool_filename)
|
@@ -569,6 +573,15 @@ module MCollective
|
|
569
573
|
parts
|
570
574
|
end
|
571
575
|
|
576
|
+
# Return a task's module
|
577
|
+
#
|
578
|
+
# @param task [String]
|
579
|
+
# @return [String] the module name
|
580
|
+
# @raise [StandardError] for invalid task names
|
581
|
+
def task_module(task)
|
582
|
+
parse_task(task)[0]
|
583
|
+
end
|
584
|
+
|
572
585
|
# Determines the cache path for a task file
|
573
586
|
#
|
574
587
|
# @param file [Hash] a file hash as per the task metadata
|
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.4
|
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: 2021-
|
11
|
+
date: 2021-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -57,6 +57,8 @@ files:
|
|
57
57
|
- lib/mcollective/agent/bolt_tasks.ddl
|
58
58
|
- lib/mcollective/agent/bolt_tasks.json
|
59
59
|
- lib/mcollective/agent/bolt_tasks.rb
|
60
|
+
- lib/mcollective/agent/choria_provision.ddl
|
61
|
+
- lib/mcollective/agent/choria_provision.json
|
60
62
|
- lib/mcollective/agent/choria_util.ddl
|
61
63
|
- lib/mcollective/agent/choria_util.json
|
62
64
|
- lib/mcollective/agent/rpcutil.ddl
|
@@ -98,46 +100,26 @@ files:
|
|
98
100
|
- lib/mcollective/connector/base.rb
|
99
101
|
- lib/mcollective/connector/nats.ddl
|
100
102
|
- lib/mcollective/connector/nats.rb
|
101
|
-
- lib/mcollective/data.rb
|
102
|
-
- lib/mcollective/data/agent_data.ddl
|
103
|
-
- lib/mcollective/data/agent_data.rb
|
104
|
-
- lib/mcollective/data/base.rb
|
105
|
-
- lib/mcollective/data/bolt_task_data.ddl
|
106
|
-
- lib/mcollective/data/bolt_task_data.rb
|
107
|
-
- lib/mcollective/data/collective_data.ddl
|
108
|
-
- lib/mcollective/data/collective_data.rb
|
109
|
-
- lib/mcollective/data/fact_data.ddl
|
110
|
-
- lib/mcollective/data/fact_data.rb
|
111
|
-
- lib/mcollective/data/fstat_data.ddl
|
112
|
-
- lib/mcollective/data/fstat_data.rb
|
113
|
-
- lib/mcollective/data/result.rb
|
114
103
|
- lib/mcollective/ddl.rb
|
115
104
|
- lib/mcollective/ddl/agentddl.rb
|
116
105
|
- lib/mcollective/ddl/base.rb
|
117
|
-
- lib/mcollective/ddl/dataddl.rb
|
118
106
|
- lib/mcollective/ddl/discoveryddl.rb
|
119
107
|
- lib/mcollective/ddl/validatorddl.rb
|
120
108
|
- lib/mcollective/discovery.rb
|
109
|
+
- lib/mcollective/discovery/broadcast.ddl
|
121
110
|
- lib/mcollective/discovery/choria.ddl
|
122
|
-
- lib/mcollective/discovery/
|
111
|
+
- lib/mcollective/discovery/delegate.ddl
|
112
|
+
- lib/mcollective/discovery/delegate.rb
|
113
|
+
- lib/mcollective/discovery/external.ddl
|
114
|
+
- lib/mcollective/discovery/file.ddl
|
123
115
|
- lib/mcollective/discovery/flatfile.ddl
|
124
|
-
- lib/mcollective/discovery/
|
116
|
+
- lib/mcollective/discovery/inventory.ddl
|
125
117
|
- lib/mcollective/discovery/mc.ddl
|
126
118
|
- lib/mcollective/discovery/mc.rb
|
127
|
-
- lib/mcollective/discovery/stdin.ddl
|
128
|
-
- lib/mcollective/discovery/stdin.rb
|
129
119
|
- lib/mcollective/exceptions.rb
|
130
120
|
- lib/mcollective/facts.rb
|
131
121
|
- lib/mcollective/facts/base.rb
|
132
122
|
- lib/mcollective/facts/yaml_facts.rb
|
133
|
-
- lib/mcollective/generators.rb
|
134
|
-
- lib/mcollective/generators/agent_generator.rb
|
135
|
-
- lib/mcollective/generators/base.rb
|
136
|
-
- lib/mcollective/generators/data_generator.rb
|
137
|
-
- lib/mcollective/generators/templates/action_snippet.erb
|
138
|
-
- lib/mcollective/generators/templates/data_input_snippet.erb
|
139
|
-
- lib/mcollective/generators/templates/ddl.erb
|
140
|
-
- lib/mcollective/generators/templates/plugin.erb
|
141
123
|
- lib/mcollective/log.rb
|
142
124
|
- lib/mcollective/logger.rb
|
143
125
|
- lib/mcollective/logger/base.rb
|
@@ -255,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
237
|
version: '0'
|
256
238
|
requirements: []
|
257
239
|
rubyforge_project:
|
258
|
-
rubygems_version: 2.6.
|
240
|
+
rubygems_version: 2.7.6.2
|
259
241
|
signing_key:
|
260
242
|
specification_version: 4
|
261
243
|
summary: Support libraries the Choria Server
|
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
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module Data
|
3
|
-
class Bolt_task_data < Base
|
4
|
-
activate_when do
|
5
|
-
Util::Choria.new.tasks_support.tasks_compatible?
|
6
|
-
end
|
7
|
-
|
8
|
-
query do |taskid|
|
9
|
-
tasks = Util::Choria.new.tasks_support
|
10
|
-
|
11
|
-
begin
|
12
|
-
status = tasks.task_status(taskid)
|
13
|
-
|
14
|
-
result[:known] = true
|
15
|
-
|
16
|
-
if status["task"]
|
17
|
-
tasks.task_status(taskid).each do |item, value|
|
18
|
-
value = value.utc.to_i if value.is_a?(Time)
|
19
|
-
value = value.to_json if value.is_a?(Hash)
|
20
|
-
|
21
|
-
result[item.intern] = value
|
22
|
-
end
|
23
|
-
|
24
|
-
result[:start_time] = result[:start_time].to_i
|
25
|
-
end
|
26
|
-
rescue
|
27
|
-
Log.debug("Task %s was not found, returning default data. Error was: %s" % [taskid, $!.to_s])
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|