foreman-tasks 9.0.4 → 9.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e88541d169e078a42071bfc0d756e358d466ae258226ed6cee8dd983fc76584
4
- data.tar.gz: d9f01f14d1c38e962d165109d9b9a9f90d65cc86c768efe7f759d8ce7ea573f1
3
+ metadata.gz: 959e8a5bbb07d3d1b6b0d1f0b57f502b4397d5797ccc3037b1e9f77a8229b06a
4
+ data.tar.gz: f0bef4b1aca4d471a2616e6b41751f1da2165eb23d9da65be87bf055bc4fab05
5
5
  SHA512:
6
- metadata.gz: c27603a712c4b81186e512cb187df730a523dda3eea70c4efc48d46c9758f6e71d500dcbe94d52e96e99a7cb47b4d698aec9c435d84fa679e86675fa0c5dd2c0
7
- data.tar.gz: 53e273339622e47f59b4074ff3f044dc2c79e673d6c113b47611be0c9ab5d77ae829d2349bcf8abf3e7058c883865fd3bc56a8bdf797c838309782c47b87f538
6
+ metadata.gz: 2740338c22e5f0371358d037212a2964d4a46119dd2d2275dc290b91742be20bdd2b74ef8b9b036f60e975b4e798424b20776eabfeaa9f49049f24a2389d48c7
7
+ data.tar.gz: 43ae242cf9b8d2e7e873ab9fa99b5be157d1f9467e931d163ccf0e831d1e1969cd81ceb0391d1397f1d6606ee159b62e88e97202ddeac112579a34cc74f3d698
data/.rubocop.yml CHANGED
@@ -10,7 +10,7 @@ AllCops:
10
10
  - 'node_modules/**/*'
11
11
  - 'locale/*'
12
12
  - 'vendor/**/*'
13
- TargetRubyVersion: 2.5
13
+ TargetRubyVersion: 2.7
14
14
 
15
15
  Lint/ShadowingOuterLocalVariable:
16
16
  Enabled: false
@@ -9,7 +9,8 @@ module Actions
9
9
  # Arguments that all the targets share
10
10
  def plan(action_class, targets, *args, concurrency_limit: nil, **kwargs)
11
11
  check_targets!(targets)
12
- limit_concurrency_level!(concurrency_limit) if concurrency_limit
12
+ extracted_concurrency_limit = extract_concurrency_limit(args, concurrency_limit)
13
+ limit_concurrency_level!(extracted_concurrency_limit) if extracted_concurrency_limit
13
14
  plan_self(:action_class => action_class.to_s,
14
15
  :target_ids => targets.map(&:id),
15
16
  :target_class => targets.first.class.to_s,
@@ -72,5 +73,11 @@ module Actions
72
73
  def total_count
73
74
  input[:target_ids].count
74
75
  end
76
+
77
+ private
78
+
79
+ def extract_concurrency_limit(args = [], limit = nil)
80
+ args.find { |arg| arg.is_a?(Hash) && arg.key?(:concurrency_limit) }&.fetch(:concurrency_limit) || limit
81
+ end
75
82
  end
76
83
  end
@@ -23,12 +23,12 @@ module ForemanTasks
23
23
  # @override
24
24
  def destroy_action; end
25
25
 
26
- def save(*args)
27
- dynflow_task_wrap(:save) { super(*args) }
26
+ def save(...)
27
+ dynflow_task_wrap(:save) { super(...) }
28
28
  end
29
29
 
30
- def save!(*args)
31
- dynflow_task_wrap(:save) { super(*args) }
30
+ def save!(...)
31
+ dynflow_task_wrap(:save) { super(...) }
32
32
  end
33
33
 
34
34
  def destroy
@@ -37,14 +37,14 @@ module ForemanTasks
37
37
 
38
38
  # In order to use host.<attribute>_changed?, we must assign_attributes to
39
39
  # the host record for these update and update! methods.
40
- def update(*args)
41
- assign_attributes(*args)
40
+ def update(...)
41
+ assign_attributes(...)
42
42
  dynflow_task_wrap(:save) { save }
43
43
  end
44
44
  alias update_attributes update
45
45
 
46
- def update!(*args)
47
- assign_attributes(*args)
46
+ def update!(...)
47
+ assign_attributes(...)
48
48
  dynflow_task_wrap(:save) { save! }
49
49
  end
50
50
  alias update_attributes! update!
@@ -42,9 +42,6 @@ module ForemanTasks
42
42
  end
43
43
 
44
44
  def update_from_batch_trigger(data, parent = {})
45
- # The ID might get overwritten later, but it is a sane default in case of async
46
- # triggering where we only get an id of a remote parent
47
- self.remote_task_id = execution_plan_id
48
45
  if data['result'] == 'success'
49
46
  self.remote_task_id = data['task_id']
50
47
  self.state = 'triggered'
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '9.0.4'.freeze
2
+ VERSION = '9.1.0'.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: 9.0.4
4
+ version: 9.1.0
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-03-19 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dynflow