foreman-tasks 6.0.2 → 6.0.3

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: 67320a79cb65e4905cce8d31974e676c75eec1c665c583f8c9df99e54a426632
4
- data.tar.gz: 249a186aea1f6aa781a654d763f213993d977577cef468c90bb8e0b7a6d9734a
3
+ metadata.gz: a5c1faf969670adf42567f2dd46b7b78dc2199561bb96b483516fe4169b7558d
4
+ data.tar.gz: 9aad850fd8decb284e1ccfc1869e5220da554e53286d31ccb3abb6da492a3ca3
5
5
  SHA512:
6
- metadata.gz: 36b628ced0600bcc9e1a31d2325736eccbfd9591aa3a37b03f0e0c2106f3db6dc327d7829733179f24b52d19084abeedfb5f7f7949990d3a15778f6baf069354
7
- data.tar.gz: c3ef36b4d8aaa7718f17d821d06b7b6297980a7cddf889a824f3c1bc34e26377cf64dc0579b74ffcf6e9e4d17b2e8f7d88697fc78a6af19b8668fb78bd0d8f55
6
+ metadata.gz: 9f76c37ad5faccedfee63f80b35b9bb1a3b65974fbef664c49baac53f6991846ed215c76cef6452bd966ea9da219d1adbae82edba3b3e783c7619ce832d51e96
7
+ data.tar.gz: d32b7d573c6809bba7bc28a4568513544752657461a9877c4f3824e8f5b0eca0b674fa9161f97cd8c72204b6edcc52f3e86480e19636538c53c8a4f473304e4f
@@ -22,7 +22,15 @@ module Actions
22
22
  end
23
23
  end
24
24
 
25
- class ProxyActionStopped; end
25
+ class ProxyActionStopped < RuntimeError
26
+ def backtrace
27
+ []
28
+ end
29
+ end
30
+
31
+ ProxyActionStoppedEvent = ::Algebrick.type do
32
+ fields! exception: type { variants NilClass, Exception }
33
+ end
26
34
 
27
35
  def plan(proxy, klass, options)
28
36
  options[:connection_options] ||= {}
@@ -52,8 +60,8 @@ module Actions
52
60
  on_data(event.data, event.meta)
53
61
  when ProxyActionMissing
54
62
  on_proxy_action_missing
55
- when ProxyActionStopped
56
- on_proxy_action_stopped
63
+ when ProxyActionStoppedEvent
64
+ on_proxy_action_stopped(event)
57
65
  else
58
66
  raise "Unexpected event #{event.inspect}"
59
67
  end
@@ -94,6 +102,8 @@ module Actions
94
102
  else
95
103
  suspend
96
104
  end
105
+ rescue RestClient::NotFound
106
+ on_proxy_action_missing
97
107
  end
98
108
 
99
109
  def cancel_proxy_task
@@ -133,8 +143,12 @@ module Actions
133
143
  error! ProxyActionMissing.new(_('Proxy task gone missing from the smart proxy'))
134
144
  end
135
145
 
136
- def on_proxy_action_stopped
137
- check_task_status
146
+ def on_proxy_action_stopped(event)
147
+ if event.exception
148
+ error! ProxyActionStopped.new(_('Failed to trigger task on the smart proxy: ') + event.exception.message)
149
+ else
150
+ check_task_status
151
+ end
138
152
  end
139
153
 
140
154
  # @override String name of an action to be triggered on server
@@ -42,7 +42,10 @@ module Actions
42
42
  rescue => e
43
43
  action_logger.warn "Could not trigger task on the smart proxy"
44
44
  action_logger.warn e
45
- batch.each { |remote_task| remote_task.update_from_batch_trigger({}) }
45
+ # The response contains non-serializable objects
46
+ # TypeError: no _dump_data is defined for class Monitor
47
+ e.response = nil
48
+ batch.each { |remote_task| remote_task.update_from_batch_trigger({ 'exception' => e }) }
46
49
  output[:failed_count] += batch.size
47
50
  end
48
51
 
@@ -49,10 +49,11 @@ module ForemanTasks
49
49
  self.parent_task_id = parent['task_id']
50
50
  self.state = 'parent-triggered'
51
51
  else
52
+ exception = data['exception']
52
53
  # Tell the action the task on the smart proxy stopped
53
54
  ForemanTasks.dynflow.world.event execution_plan_id,
54
55
  step_id,
55
- ::Actions::ProxyAction::ProxyActionStopped.new,
56
+ ::Actions::ProxyAction::ProxyActionStoppedEvent[exception],
56
57
  optional: true
57
58
  end
58
59
  save!
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '6.0.2'.freeze
2
+ VERSION = '6.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.0.3
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: 2022-05-13 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow
@@ -608,7 +608,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
608
608
  - !ruby/object:Gem::Version
609
609
  version: '0'
610
610
  requirements: []
611
- rubygems_version: 3.1.4
611
+ rubygems_version: 3.3.20
612
612
  signing_key:
613
613
  specification_version: 4
614
614
  summary: Foreman plugin for showing tasks information for resources and users