foreman-tasks 9.0.1 → 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: c07047587cf02128c555096e198c263c44e0309511968150c6ffad1014611ccc
4
- data.tar.gz: 0a67b8fa80f6a9c6ab2d15659adea5c067fc2ccff70ae1fab6df679580fc28cc
3
+ metadata.gz: 959e8a5bbb07d3d1b6b0d1f0b57f502b4397d5797ccc3037b1e9f77a8229b06a
4
+ data.tar.gz: f0bef4b1aca4d471a2616e6b41751f1da2165eb23d9da65be87bf055bc4fab05
5
5
  SHA512:
6
- metadata.gz: 1144a9f0f759891f5e99ecffbae42f9342f20eb6bd63adfeea0c7ded40cc38254be051024dbf344e3cebc40191098b4aa4ffe7d2d005c73e28b06fbd0e4a9349
7
- data.tar.gz: ba9a9c54f9c924a0ccb49f93b9cb22bad9132e4665b1d7a764667f3209d2cc26d6edff9d5e58a818b70500fe604d6074b2dc92a0aba3b0acdfab4b7078f3869e
6
+ metadata.gz: 2740338c22e5f0371358d037212a2964d4a46119dd2d2275dc290b91742be20bdd2b74ef8b9b036f60e975b4e798424b20776eabfeaa9f49049f24a2389d48c7
7
+ data.tar.gz: 43ae242cf9b8d2e7e873ab9fa99b5be157d1f9467e931d163ccf0e831d1e1969cd81ceb0391d1397f1d6606ee159b62e88e97202ddeac112579a34cc74f3d698
@@ -1,68 +1,20 @@
1
- name: Ruby Testing
2
- on: [pull_request]
3
- env:
4
- RAILS_ENV: test
5
- DATABASE_URL: postgresql://postgres:@localhost/test
6
- DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
7
- BUNDLE_WITHOUT: "journald:development:console:mysql2:sqlite:libvirt"
1
+ ---
2
+ name: CI
3
+
4
+ on: pull_request
5
+
8
6
  concurrency:
9
- group: ${{ github.workflow }}-${{ github.ref }}
7
+ group: ${{ github.ref_name }}-${{ github.workflow }}
10
8
  cancel-in-progress: true
9
+
11
10
  jobs:
12
11
  rubocop:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v2
16
- - name: Setup Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 2.7
20
- bundler-cache: true
21
- - name: Run rubocop
22
- run: bundle exec rubocop
23
- test_ruby:
24
- runs-on: ubuntu-latest
12
+ name: Rubocop
13
+ uses: theforeman/actions/.github/workflows/rubocop.yml@v0
14
+
15
+ test:
16
+ name: Ruby
25
17
  needs: rubocop
26
- timeout-minutes: 15
27
- services:
28
- postgres:
29
- image: postgres:12.1
30
- ports: ['5432:5432']
31
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
32
- strategy:
33
- fail-fast: false
34
- matrix:
35
- foreman-core-branch: [develop]
36
- ruby-version: [2.7]
37
- node-version: [12]
38
- steps:
39
- - run: sudo apt-get update
40
- - run: sudo apt-get install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev
41
- - uses: actions/checkout@v2
42
- with:
43
- repository: theforeman/foreman
44
- ref: ${{ matrix.foreman-core-branch }}
45
- - uses: actions/checkout@v2
46
- with:
47
- path: foreman-tasks
48
- - name: Setup Plugin in Foreman
49
- run: |
50
- echo "gem 'foreman-tasks', path: './foreman-tasks'" > bundler.d/foreman-tasks.local.rb
51
- echo "gem 'sqlite3'" >> bundler.d/foreman-tasks.local.rb
52
- - name: Setup Ruby
53
- uses: ruby/setup-ruby@v1
54
- with:
55
- ruby-version: ${{ matrix.ruby-version }}
56
- bundler-cache: true
57
- - name: Setup Node
58
- uses: actions/setup-node@v1
59
- with:
60
- node-version: ${{ matrix.node-version }}
61
- - name: Prepare test env
62
- run: |
63
- bundle exec rake db:create
64
- bundle exec rake db:migrate
65
- - name: Run plugin tests
66
- run: |
67
- bundle exec rake test:foreman_tasks
68
- bundle exec rake test TEST="test/unit/foreman/access_permissions_test.rb"
18
+ uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0
19
+ with:
20
+ plugin: foreman-tasks
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!
@@ -11,12 +11,12 @@ module ForemanTasks
11
11
  [:subnet, :fallback, :global]
12
12
  end
13
13
 
14
- def available_proxies(*_args)
14
+ def available_proxies(*_args, **_kwargs)
15
15
  raise NotImplementedError
16
16
  end
17
17
 
18
- def determine_proxy(*args)
19
- available_proxies = self.available_proxies(*args)
18
+ def determine_proxy(*args, **kwargs)
19
+ available_proxies = self.available_proxies(*args, **kwargs)
20
20
  return :not_defined if available_proxies.empty? || available_proxies.values.all?(&:empty?)
21
21
  proxy = nil
22
22
 
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '9.0.1'.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.1
4
+ version: 9.1.0
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: 2024-01-10 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
@@ -613,7 +613,7 @@ homepage: https://github.com/theforeman/foreman-tasks
613
613
  licenses:
614
614
  - GPL-3.0
615
615
  metadata: {}
616
- post_install_message:
616
+ post_install_message:
617
617
  rdoc_options: []
618
618
  require_paths:
619
619
  - lib
@@ -628,8 +628,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
628
628
  - !ruby/object:Gem::Version
629
629
  version: '0'
630
630
  requirements: []
631
- rubygems_version: 3.1.6
632
- signing_key:
631
+ rubygems_version: 3.3.26
632
+ signing_key:
633
633
  specification_version: 4
634
634
  summary: Foreman plugin for showing tasks information for resources and users
635
635
  test_files: