smart_proxy_dynflow 0.9.3 → 1.0.0
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/smart_proxy_dynflow/action/runner.rb +1 -0
- data/lib/smart_proxy_dynflow/api.rb +1 -1
- data/lib/smart_proxy_dynflow/continuous_output.rb +10 -8
- data/lib/smart_proxy_dynflow/runner/base.rb +4 -3
- data/lib/smart_proxy_dynflow/runner/parent.rb +6 -6
- data/lib/smart_proxy_dynflow/runner/update.rb +3 -2
- data/lib/smart_proxy_dynflow/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d83b16dc061524ea6fd926d762b5c277ec04d67a343ee284fc07150288bc023
|
|
4
|
+
data.tar.gz: ebce0c873b7c456628669889581c4cddab8c534f81bdd4b60f36dd1de99bb9fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f0fd0fb0fe9251accb11d7759bfd9ca1319325ac5244d5f17d53af9e887b29bbf45a95689d1cca47b218707a589d6b31e7d7b8b57bf3f92a7a7cfeb465aa2df
|
|
7
|
+
data.tar.gz: af76df1a492d8175052d8211955301390376941814c3780f70d9ade1fd9a1aaa82406f856012667d7c5dd0c9c1b08f6c90cb84c3468dcb50668c5b93e8f285c4
|
|
@@ -13,7 +13,7 @@ module Proxy
|
|
|
13
13
|
|
|
14
14
|
include ::Sinatra::Authorization::Helpers
|
|
15
15
|
|
|
16
|
-
TASK_UPDATE_REGEXP_PATH = %r{/tasks/(\S+)/(update|done)}
|
|
16
|
+
TASK_UPDATE_REGEXP_PATH = %r{/tasks/(\S+)/(update|done)}
|
|
17
17
|
|
|
18
18
|
before do
|
|
19
19
|
if match = request.path_info.match(TASK_UPDATE_REGEXP_PATH)
|
|
@@ -37,18 +37,20 @@ module Proxy::Dynflow
|
|
|
37
37
|
raw_outputs.map { |output| output['output'] }.join("\n")
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def add_exception(context, exception, timestamp
|
|
41
|
-
add_output(context + ": #{exception.class} - #{exception.message}", 'debug', timestamp)
|
|
40
|
+
def add_exception(context, exception, timestamp: Time.now.getlocal, id: nil)
|
|
41
|
+
add_output(context + ": #{exception.class} - #{exception.message}", 'debug', timestamp: timestamp, id: id)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def add_output(
|
|
45
|
-
add_raw_output(self.class.format_output(
|
|
44
|
+
def add_output(...)
|
|
45
|
+
add_raw_output(self.class.format_output(...))
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
def self.format_output(message, type = 'debug', timestamp
|
|
49
|
-
{ 'output_type' => type,
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
def self.format_output(message, type = 'debug', timestamp: Time.now.getlocal, id: nil)
|
|
49
|
+
base = { 'output_type' => type,
|
|
50
|
+
'output' => message,
|
|
51
|
+
'timestamp' => timestamp.to_f }
|
|
52
|
+
base['id'] = id if id
|
|
53
|
+
base
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
end
|
|
@@ -58,8 +58,8 @@ module Proxy::Dynflow
|
|
|
58
58
|
# or nil for no timeout
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def publish_data(
|
|
62
|
-
@continuous_output.add_output(
|
|
61
|
+
def publish_data(...)
|
|
62
|
+
@continuous_output.add_output(...)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def publish_exception(context, exception, fatal = true)
|
|
@@ -71,6 +71,7 @@ module Proxy::Dynflow
|
|
|
71
71
|
|
|
72
72
|
def publish_exit_status(status)
|
|
73
73
|
@exit_status = status
|
|
74
|
+
@exit_status_timestamp = Time.now.utc
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
def dispatch_exception(context, exception)
|
|
@@ -90,7 +91,7 @@ module Proxy::Dynflow
|
|
|
90
91
|
end
|
|
91
92
|
|
|
92
93
|
def new_update(data, exit_status)
|
|
93
|
-
{ @suspended_action => Runner::Update.new(data, exit_status) }
|
|
94
|
+
{ @suspended_action => Runner::Update.new(data, exit_status, exit_status_timestamp: @exit_status_timestamp) }
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
def initialize_continuous_outputs
|
|
@@ -13,13 +13,13 @@ module Proxy::Dynflow
|
|
|
13
13
|
|
|
14
14
|
def generate_updates
|
|
15
15
|
base = {}
|
|
16
|
-
base[@suspended_action] = Runner::Update.new(Proxy::Dynflow::ContinuousOutput.new, @exit_status) if @exit_status
|
|
16
|
+
base[@suspended_action] = Runner::Update.new(Proxy::Dynflow::ContinuousOutput.new, @exit_status, exit_status_timestamp: @exit_status_timestamp) if @exit_status
|
|
17
17
|
# Operate on all hosts if the main process ended or only on hosts for which we have updates
|
|
18
18
|
@outputs.reject { |_, output| @exit_status.nil? && output.empty? }
|
|
19
19
|
.reduce(base) do |acc, (identifier, output)|
|
|
20
20
|
@outputs[identifier] = Proxy::Dynflow::ContinuousOutput.new # Create a new ContinuousOutput for next round of updates
|
|
21
21
|
exit_status = @exit_statuses[identifier] || @exit_status if @exit_status
|
|
22
|
-
acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status))
|
|
22
|
+
acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status, exit_status_timestamp: @exit_status_timestamp))
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -35,16 +35,16 @@ module Proxy::Dynflow
|
|
|
35
35
|
Dynflow::Action::Suspended.new OpenStruct.new(options)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def broadcast_data(
|
|
39
|
-
@outputs.each_value { |output| output.add_output(
|
|
38
|
+
def broadcast_data(...)
|
|
39
|
+
@outputs.each_value { |output| output.add_output(...) }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def publish_data(_data, _type)
|
|
43
43
|
true
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
def publish_data_for(identifier, data, type)
|
|
47
|
-
@outputs[identifier].add_output(data, type)
|
|
46
|
+
def publish_data_for(identifier, data, type, **kwargs)
|
|
47
|
+
@outputs[identifier].add_output(data, type, **kwargs)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def dispatch_exception(context, exception)
|
|
@@ -7,11 +7,12 @@ module Proxy::Dynflow
|
|
|
7
7
|
# Runner::Update represents chunk of data produced by runner that
|
|
8
8
|
# can be consumed by other components, such as RunnerAction
|
|
9
9
|
class Update
|
|
10
|
-
attr_reader :continuous_output, :exit_status
|
|
10
|
+
attr_reader :continuous_output, :exit_status, :exit_status_timestamp
|
|
11
11
|
|
|
12
|
-
def initialize(continuous_output, exit_status)
|
|
12
|
+
def initialize(continuous_output, exit_status, exit_status_timestamp: nil)
|
|
13
13
|
@continuous_output = continuous_output
|
|
14
14
|
@exit_status = exit_status
|
|
15
|
+
@exit_status_timestamp = exit_status_timestamp || Time.now.utc if @exit_status
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def self.encode_exception(context, exception, fatal = true)
|
metadata
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smart_proxy_dynflow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ivan Nečas
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: dynflow
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
18
|
version: '1.6'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '3.0'
|
|
20
22
|
type: :runtime
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
25
|
requirements:
|
|
24
|
-
- - "
|
|
26
|
+
- - ">="
|
|
25
27
|
- !ruby/object:Gem::Version
|
|
26
28
|
version: '1.6'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '3.0'
|
|
27
32
|
- !ruby/object:Gem::Dependency
|
|
28
33
|
name: rest-client
|
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -108,10 +113,9 @@ files:
|
|
|
108
113
|
- settings.d/dynflow.yml.example
|
|
109
114
|
homepage: https://github.com/theforeman/smart_proxy_dynflow
|
|
110
115
|
licenses:
|
|
111
|
-
- GPL-3.0
|
|
116
|
+
- GPL-3.0-only
|
|
112
117
|
metadata:
|
|
113
118
|
rubygems_mfa_required: 'true'
|
|
114
|
-
post_install_message:
|
|
115
119
|
rdoc_options: []
|
|
116
120
|
require_paths:
|
|
117
121
|
- lib
|
|
@@ -119,18 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
119
123
|
requirements:
|
|
120
124
|
- - ">="
|
|
121
125
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '
|
|
123
|
-
- - "<"
|
|
124
|
-
- !ruby/object:Gem::Version
|
|
125
|
-
version: '4'
|
|
126
|
+
version: '3.0'
|
|
126
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
128
|
requirements:
|
|
128
129
|
- - ">="
|
|
129
130
|
- !ruby/object:Gem::Version
|
|
130
131
|
version: '0'
|
|
131
132
|
requirements: []
|
|
132
|
-
rubygems_version:
|
|
133
|
-
signing_key:
|
|
133
|
+
rubygems_version: 4.0.3
|
|
134
134
|
specification_version: 4
|
|
135
135
|
summary: Dynflow runtime for Foreman smart proxy
|
|
136
136
|
test_files: []
|