smart_proxy_dynflow 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4cbd5ee3715ae77a996375dad27d44ef2eba5bde98687c01852b63f018de384
4
- data.tar.gz: f4852c006912c4d80e9ddd1f3aa846d17845dfc46a34ae047ec0dad6887d6c93
3
+ metadata.gz: e7e0e12ddc21b25d46fe7d1ea6c7af572f98d0fff69e19ebf4764059e41a6644
4
+ data.tar.gz: 2326988132e96960c1739c41b1b99f53452cf3684839f97e8cb4c050459b43df
5
5
  SHA512:
6
- metadata.gz: af596d7d35ec2d1231864f0982f4af90944a723998e6666343ad0cda0fd5b1c470e3ece13e7d89b4940c3ae4c22099d3f31dbd46e58dd8c5a56f90e40e408995
7
- data.tar.gz: be433c2faeaf439e79ef77b05c36bec2c42b44f98e524b216cc0419b2097b32481a75977aa9c34f248b21c944b5ae71a98a71e1f6b5cccf786e3d12ad14d697a
6
+ metadata.gz: bc8c5012e01624d165f801e6de4f3d0707cbdcfa42437fc0887fe10ccc89d5606813fae0fc8761c73cee40bae0ae275d0115165521f903e7ee24f90a129423bb
7
+ data.tar.gz: a20e4eb660064c01d2ede0c5e38ccadaded5d0feac2768865e59295b2a3ba44a47be743a3bd074f68cdb11891930bbe08f8b554033f24907b64e0d0d09bd843b
@@ -63,6 +63,7 @@ module Proxy::Dynflow
63
63
 
64
64
  def finish_run(update)
65
65
  output[:exit_status] = update.exit_status
66
+ output[:exit_status_timestamp] = update.exit_status_timestamp.to_f
66
67
  output[:result] = output_result
67
68
  drop_output_chunks!
68
69
  end
@@ -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 = Time.now.getlocal)
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(*args)
45
- add_raw_output(self.class.format_output(*args))
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 = Time.now.getlocal)
49
- { 'output_type' => type,
50
- 'output' => message,
51
- 'timestamp' => timestamp.to_f }
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(data, type)
62
- @continuous_output.add_output(data, type)
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(data, type)
39
- @outputs.each_value { |output| output.add_output(data, type) }
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Proxy
4
4
  module Dynflow
5
- VERSION = '0.9.3'
5
+ VERSION = '0.9.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_dynflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -108,7 +108,7 @@ files:
108
108
  - settings.d/dynflow.yml.example
109
109
  homepage: https://github.com/theforeman/smart_proxy_dynflow
110
110
  licenses:
111
- - GPL-3.0
111
+ - GPL-3.0-only
112
112
  metadata:
113
113
  rubygems_mfa_required: 'true'
114
114
  post_install_message:
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.3.26
132
+ rubygems_version: 3.3.27
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Dynflow runtime for Foreman smart proxy