foreman-tasks-core 0.3.4 → 0.3.5
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 +4 -4
- data/lib/foreman_tasks_core/runner/dispatcher.rb +17 -23
- data/lib/foreman_tasks_core/runner/parent.rb +12 -14
- data/lib/foreman_tasks_core/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eeba72428b030c0bcec9f51c7b58cbfb7e046eb7279b68b6030b46aaa72a434
|
4
|
+
data.tar.gz: 9a40808da08504914c856d9407a7d454a5c5045125a768ee5d6b54424444bd93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9cd9a1e5c8f247bd5b3f335998d2cba76d2a17ba6edfae529713f6eaaa60de6133d61125e76175544a8248f259f48bfa715de46cd4f1ff5132844d1c5c0250d
|
7
|
+
data.tar.gz: 2ddb3a83487315cdbc6ecf32886d67f599badb47f61f02019122fed0103602af72f0c8e5f999016dfec36a3caa56c17202fb3ce0426f5814084d5703bd702991
|
@@ -120,39 +120,33 @@ module ForemanTasksCore
|
|
120
120
|
|
121
121
|
def start(suspended_action, runner)
|
122
122
|
synchronize do
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
return nil
|
134
|
-
end
|
123
|
+
raise "Actor with runner id #{runner.id} already exists" if @runner_actors[runner.id]
|
124
|
+
runner.logger = @logger
|
125
|
+
runner_actor = RunnerActor.spawn("runner-actor-#{runner.id}", self, suspended_action, runner, @clock, @logger)
|
126
|
+
@runner_actors[runner.id] = runner_actor
|
127
|
+
@runner_suspended_actions[runner.id] = suspended_action
|
128
|
+
runner_actor.tell(:start_runner)
|
129
|
+
return runner.id
|
130
|
+
rescue => exception
|
131
|
+
_handle_command_exception(runner.id, exception)
|
132
|
+
return nil
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
138
136
|
def kill(runner_id)
|
139
137
|
synchronize do
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
_handle_command_exception(runner_id, exception, false)
|
145
|
-
end
|
138
|
+
runner_actor = @runner_actors[runner_id]
|
139
|
+
runner_actor.tell(:kill) if runner_actor
|
140
|
+
rescue => exception
|
141
|
+
_handle_command_exception(runner_id, exception, false)
|
146
142
|
end
|
147
143
|
end
|
148
144
|
|
149
145
|
def finish(runner_id)
|
150
146
|
synchronize do
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
_handle_command_exception(runner_id, exception, false)
|
155
|
-
end
|
147
|
+
_finish(runner_id)
|
148
|
+
rescue => exception
|
149
|
+
_handle_command_exception(runner_id, exception, false)
|
156
150
|
end
|
157
151
|
end
|
158
152
|
|
@@ -10,21 +10,19 @@ module ForemanTasksCore
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def generate_updates
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
13
|
+
base = {}
|
14
|
+
base[@suspended_action] = Runner::Update.new(ForemanTasksCore::ContinuousOutput.new, @exit_status) if @exit_status
|
15
|
+
# Operate on all hosts if the main process ended or only on hosts for which we have updates
|
16
|
+
@outputs.reject { |_, output| @exit_status.nil? && output.empty? }
|
17
|
+
.reduce(base) do |acc, (identifier, output)|
|
18
|
+
@outputs[identifier] = ForemanTasksCore::ContinuousOutput.new # Create a new ContinuousOutput for next round of updates
|
19
|
+
exit_status = @exit_statuses[identifier] || @exit_status if @exit_status
|
20
|
+
acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status))
|
21
|
+
end
|
24
22
|
end
|
25
23
|
|
26
24
|
def initialize_continuous_outputs
|
27
|
-
@outputs =
|
25
|
+
@outputs = @targets.keys.reduce({}) do |acc, target|
|
28
26
|
acc.merge(target => ForemanTasksCore::ContinuousOutput.new)
|
29
27
|
end
|
30
28
|
end
|
@@ -39,8 +37,8 @@ module ForemanTasksCore
|
|
39
37
|
@outputs.each { |_k, output| output.add_output(data, type) }
|
40
38
|
end
|
41
39
|
|
42
|
-
def publish_data(
|
43
|
-
|
40
|
+
def publish_data(_data, _type)
|
41
|
+
true
|
44
42
|
end
|
45
43
|
|
46
44
|
def publish_data_for(identifier, data, type)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: 1.2.0
|
27
27
|
description: 'Common code used both at Forman and Foreman proxy regarding tasks
|
28
28
|
|
29
|
-
'
|
29
|
+
'
|
30
30
|
email:
|
31
31
|
- inecas@redhat.com
|
32
32
|
executables: []
|
@@ -60,9 +60,10 @@ files:
|
|
60
60
|
- lib/foreman_tasks_core/ticker.rb
|
61
61
|
- lib/foreman_tasks_core/version.rb
|
62
62
|
homepage: https://github.com/theforeman/foreman-tasks
|
63
|
-
licenses:
|
63
|
+
licenses:
|
64
|
+
- GPL-3.0
|
64
65
|
metadata: {}
|
65
|
-
post_install_message:
|
66
|
+
post_install_message:
|
66
67
|
rdoc_options: []
|
67
68
|
require_paths:
|
68
69
|
- lib
|
@@ -77,8 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
81
|
-
signing_key:
|
81
|
+
rubygems_version: 3.1.2
|
82
|
+
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: Common code used both at Forman and Foreman proxy regarding tasks
|
84
85
|
test_files: []
|