foreman-tasks 10.0.2 → 11.0.1
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/.github/workflows/js_tests.yml +8 -27
- data/.github/workflows/release.yml +20 -0
- data/app/models/foreman_tasks/triggering.rb +5 -0
- data/lib/foreman_tasks/engine.rb +105 -104
- data/lib/foreman_tasks/version.rb +1 -1
- data/test/factories/triggering_factory.rb +1 -1
- data/test/unit/triggering_test.rb +7 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/OtherInfo.js +1 -0
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/Components/StoppedTasksCard/__snapshots__/OtherInfo.test.js.snap +1 -3
- data/webpack/ForemanTasks/Components/TasksDashboard/Components/TasksLabelsRow/TasksLabelsRow.scss +1 -1
- data/webpack/ForemanTasks/Components/TasksDashboard/TasksDashboard.scss +2 -2
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79bd6594ab916273ed9721d27414688ac717fd041ba33fdc67a1531e0ff0e30c
|
4
|
+
data.tar.gz: 91de29666d6b045b9179f662bda4f645e4532683ec1ff5e397b6f90948e6f32a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81a6e7b9989f9becb04bf6486ded109c937e9395325ac060d9ce9b027343f44b2be70d44a1b997cb19c15520dabf7bdd654ddf7b017482b09e812fa980a7f103
|
7
|
+
data.tar.gz: ed7f40efaae46bbaec076deb15d0c7ff076fe661f5ad28bff67694070954eeac0229d3304a81375982cf96e9f11b60f7fb94402285310598837e52b0ffcec499
|
@@ -1,33 +1,14 @@
|
|
1
1
|
name: JavaScript Testing
|
2
|
+
|
2
3
|
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
3
7
|
pull_request:
|
4
|
-
paths:
|
5
|
-
- 'webpack/**'
|
6
|
-
- 'package.json'
|
7
|
-
- '.github/workflows/js_tests.yml'
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test_js:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
node-version:
|
16
|
-
- 12
|
17
|
-
- 14
|
18
|
-
steps:
|
19
|
-
- uses: actions/checkout@v2
|
20
|
-
- name: Setup Node
|
21
|
-
uses: actions/setup-node@v1
|
22
|
-
with:
|
23
|
-
node-version: ${{ matrix.node-version }}
|
24
|
-
- name: Npm install
|
25
|
-
run: npm install
|
26
|
-
- name: Run plugin linter
|
27
|
-
run: npm run lint
|
28
|
-
- name: Run plugin tests
|
29
|
-
run: npm run test
|
30
|
-
- name: Publish Coveralls
|
31
|
-
uses: coverallsapp/github-action@master
|
32
|
-
with:
|
33
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
11
|
+
name: JavaScript
|
12
|
+
uses: theforeman/actions/.github/workflows/foreman_plugin_js.yml@v0
|
13
|
+
with:
|
14
|
+
plugin: foreman-tasks
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
# Pattern matched against refs/tags
|
6
|
+
tags:
|
7
|
+
- '**'
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
release:
|
11
|
+
name: Release gem
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
environment: release
|
14
|
+
if: github.repository_owner == 'theforeman'
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
id-token: write
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: voxpupuli/ruby-release@v0
|
@@ -38,6 +38,7 @@ module ForemanTasks
|
|
38
38
|
:if => proc { |t| t.recurring? && t.input_type == :monthly } }
|
39
39
|
validate :can_start_recurring, :if => :recurring?
|
40
40
|
validate :can_start_future, :if => :future?
|
41
|
+
validate :start_at_is_not_past
|
41
42
|
|
42
43
|
def self.new_from_params(params = {})
|
43
44
|
new(params.except(:mode, :start_at, :start_before)).tap do |triggering|
|
@@ -121,5 +122,9 @@ module ForemanTasks
|
|
121
122
|
parse_start_at!
|
122
123
|
errors.add(:start_before_raw, _('The task could not be started')) if !start_before.nil? && start_before < start_at
|
123
124
|
end
|
125
|
+
|
126
|
+
def start_at_is_not_past
|
127
|
+
errors.add(:start_at, _('is in the past')) if !start_at.nil? && start_at < Time.zone.now
|
128
|
+
end
|
124
129
|
end
|
125
130
|
end
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -16,121 +16,122 @@ module ForemanTasks
|
|
16
16
|
SETTINGS[:foreman_tasks] = { :assets => { :precompile => assets_to_precompile } }
|
17
17
|
end
|
18
18
|
|
19
|
-
initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
19
|
+
initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do
|
20
|
+
Foreman::Plugin.register :"foreman-tasks" do
|
21
|
+
requires_foreman '>= 3.15'
|
22
|
+
divider :top_menu, :parent => :monitor_menu, :last => true, :caption => N_('Foreman Tasks')
|
23
|
+
menu :top_menu, :tasks,
|
24
|
+
:url_hash => { :controller => 'foreman_tasks/tasks', :action => :index },
|
25
|
+
:caption => N_('Tasks'),
|
26
|
+
:parent => :monitor_menu,
|
27
|
+
:last => true
|
28
|
+
|
29
|
+
menu :top_menu, :recurring_logics,
|
30
|
+
:url_hash => { :controller => 'foreman_tasks/recurring_logics', :action => :index },
|
31
|
+
:caption => N_('Recurring Logics'),
|
32
|
+
:parent => :monitor_menu,
|
33
|
+
:last => true
|
34
|
+
|
35
|
+
security_block :foreman_tasks do |_map|
|
36
|
+
permission :view_foreman_tasks, { :'foreman_tasks/tasks' => [:auto_complete_search, :sub_tasks, :index, :summary, :summary_sub_tasks, :show],
|
37
|
+
:'foreman_tasks/react' => [:index],
|
38
|
+
:'foreman_tasks/api/tasks' => [:bulk_search, :show, :index, :summary, :summary_sub_tasks, :details, :sub_tasks] }, :resource_type => 'ForemanTasks::Task'
|
39
|
+
permission :edit_foreman_tasks, { :'foreman_tasks/tasks' => [:resume, :unlock, :force_unlock, :cancel_step, :cancel, :abort],
|
40
|
+
:'foreman_tasks/api/tasks' => [:bulk_resume, :bulk_cancel, :bulk_stop] }, :resource_type => 'ForemanTasks::Task'
|
41
|
+
|
42
|
+
permission :create_recurring_logics, {}, :resource_type => 'ForemanTasks::RecurringLogic'
|
43
|
+
|
44
|
+
permission :view_recurring_logics, { :'foreman_tasks/recurring_logics' => [:auto_complete_search, :index, :show],
|
45
|
+
:'foreman_tasks/api/recurring_logics' => [:index, :show] }, :resource_type => 'ForemanTasks::RecurringLogic'
|
46
|
+
|
47
|
+
permission :edit_recurring_logics, { :'foreman_tasks/recurring_logics' => [:cancel, :enable, :disable, :clear_cancelled],
|
48
|
+
:'foreman_tasks/api/recurring_logics' => [:cancel, :update, :bulk_destroy] }, :resource_type => 'ForemanTasks::RecurringLogic'
|
49
|
+
end
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
51
|
+
add_all_permissions_to_default_roles
|
52
|
+
|
53
|
+
settings do
|
54
|
+
category(:tasks, N_('Tasks')) do
|
55
|
+
setting('foreman_tasks_sync_task_timeout',
|
56
|
+
type: :integer,
|
57
|
+
description: N_('Number of seconds to wait for synchronous task to finish.'),
|
58
|
+
default: 120,
|
59
|
+
full_name: N_('Sync task timeout'))
|
60
|
+
setting('dynflow_enable_console',
|
61
|
+
type: :boolean,
|
62
|
+
description: N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'),
|
63
|
+
default: true,
|
64
|
+
full_name: N_('Enable dynflow console'))
|
65
|
+
setting('dynflow_console_require_auth',
|
66
|
+
type: :boolean,
|
67
|
+
description: N_('Require user to be authenticated as user with admin rights when accessing dynflow console'),
|
68
|
+
default: true,
|
69
|
+
full_name: N_('Require auth for dynflow console'))
|
70
|
+
setting('foreman_tasks_proxy_action_retry_count',
|
71
|
+
type: :integer,
|
72
|
+
description: N_('Number of attempts to start a task on the smart proxy before failing'),
|
73
|
+
default: 4,
|
74
|
+
full_name: N_('Proxy action retry count'))
|
75
|
+
setting('foreman_tasks_proxy_action_retry_interval',
|
76
|
+
type: :integer,
|
77
|
+
description: N_('Time in seconds between retries'),
|
78
|
+
default: 15,
|
79
|
+
full_name: N_('Proxy action retry interval'))
|
80
|
+
setting('foreman_tasks_proxy_batch_trigger',
|
81
|
+
type: :boolean,
|
82
|
+
description: N_('Allow triggering tasks on the smart proxy in batches'),
|
83
|
+
default: true,
|
84
|
+
full_name: N_('Allow proxy batch tasks'))
|
85
|
+
setting('foreman_tasks_proxy_batch_size',
|
86
|
+
type: :integer,
|
87
|
+
description: N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'),
|
88
|
+
default: 100,
|
89
|
+
full_name: N_('Proxy tasks batch size'))
|
90
|
+
setting('foreman_tasks_troubleshooting_url',
|
91
|
+
type: :string,
|
92
|
+
description: N_('Url pointing to the task troubleshooting documentation. '\
|
93
|
+
'It should contain %{label} placeholder, that will be replaced with normalized task label '\
|
94
|
+
'(restricted to only alphanumeric characters)). %{version} placeholder is also available.'),
|
95
|
+
default: nil,
|
96
|
+
full_name: N_('Tasks troubleshooting URL'))
|
97
|
+
setting('foreman_tasks_polling_multiplier',
|
98
|
+
type: :integer,
|
99
|
+
description: N_('Polling multiplier which is used to multiply the default polling intervals. '\
|
100
|
+
'This can be used to prevent polling too frequently for long running tasks.'),
|
101
|
+
default: 1,
|
102
|
+
full_name: N_("Polling intervals multiplier"),
|
103
|
+
validate: { numericality: { greater_than: 0 } })
|
106
104
|
end
|
105
|
+
end
|
107
106
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
|
107
|
+
register_graphql_query_field :task, '::Types::Task', :record_field
|
108
|
+
register_graphql_query_field :tasks, '::Types::Task', :collection_field
|
109
|
+
register_graphql_query_field :recurring_logic, '::Types::RecurringLogic', :record_field
|
110
|
+
register_graphql_query_field :recurring_logics, '::Types::RecurringLogic', :collection_field
|
114
111
|
|
115
|
-
|
116
|
-
logger :action, :enabled => true
|
112
|
+
register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
|
117
113
|
|
118
|
-
|
119
|
-
|
120
|
-
role 'Tasks Reader', [:view_foreman_tasks],
|
121
|
-
'Role granting permissions to inspect tasks'
|
114
|
+
logger :dynflow, :enabled => true
|
115
|
+
logger :action, :enabled => true
|
122
116
|
|
123
|
-
|
124
|
-
|
117
|
+
role 'Tasks Manager', [:view_foreman_tasks, :edit_foreman_tasks],
|
118
|
+
'Role granting permissions to inspect, cancel, resume and unlock tasks'
|
119
|
+
role 'Tasks Reader', [:view_foreman_tasks],
|
120
|
+
'Role granting permissions to inspect tasks'
|
125
121
|
|
126
|
-
|
122
|
+
widget 'foreman_tasks/tasks/dashboard/tasks_status', :sizex => 6, :sizey => 1, :name => N_('Task Status')
|
123
|
+
widget 'foreman_tasks/tasks/dashboard/latest_tasks_in_error_warning', :sizex => 6, :sizey => 1, :name => N_('Latest Warning/Error Tasks')
|
127
124
|
|
128
|
-
|
129
|
-
extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
|
130
|
-
end
|
125
|
+
register_gettext domain: "foreman_tasks"
|
131
126
|
end
|
132
127
|
end
|
133
128
|
|
129
|
+
config.after_initialize do
|
130
|
+
ForemanTasks.dynflow.eager_load_actions!
|
131
|
+
plugin = ::Foreman::Plugin.find("foreman-tasks")
|
132
|
+
plugin.extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
|
133
|
+
end
|
134
|
+
|
134
135
|
initializer 'foreman_tasks.apipie' do
|
135
136
|
# this condition is here for compatibility reason to work with Foreman 1.4.x
|
136
137
|
if Apipie.configuration.api_controllers_matcher.is_a?(Array) &&
|
@@ -13,6 +13,13 @@ class TriggeringTest < ActiveSupport::TestCase
|
|
13
13
|
assert_not_predicate(triggering, :valid?)
|
14
14
|
end
|
15
15
|
|
16
|
+
it 'is invalid when future execution is in the past' do
|
17
|
+
triggering = FactoryBot.build(:triggering, :future)
|
18
|
+
assert_predicate(triggering, :valid?)
|
19
|
+
triggering.start_at = Time.zone.now - 1.day
|
20
|
+
assert_not_predicate(triggering, :valid?)
|
21
|
+
end
|
22
|
+
|
16
23
|
it 'is invalid when recurring logic is invalid' do
|
17
24
|
triggering = FactoryBot.build(:triggering, :recurring)
|
18
25
|
assert_predicate(triggering, :valid?)
|
@@ -12,9 +12,6 @@ exports[`OtherInfo render 1`] = `
|
|
12
12
|
<span>
|
13
13
|
<InfoCircleIcon
|
14
14
|
className="pficon"
|
15
|
-
color="currentColor"
|
16
|
-
noVerticalAlign={false}
|
17
|
-
size="sm"
|
18
15
|
/>
|
19
16
|
<span>
|
20
17
|
Other:
|
@@ -24,6 +21,7 @@ exports[`OtherInfo render 1`] = `
|
|
24
21
|
</Tooltip>
|
25
22
|
<Button
|
26
23
|
onClick={[Function]}
|
24
|
+
ouiaId="stopped-other-tasks-button"
|
27
25
|
variant="link"
|
28
26
|
>
|
29
27
|
7
|
@@ -1,5 +1,5 @@
|
|
1
|
-
@import '
|
2
|
-
@import '
|
1
|
+
@import 'foremanReact/common/variables';
|
2
|
+
@import 'foremanReact/common/scss/mixins';
|
3
3
|
|
4
4
|
@mixin create-tasks-dashboard-column($columns: 12, $screen-min: 0, $gutter: $grid-gutter-width) {
|
5
5
|
@media (min-width: $screen-min) {
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 11.0.1
|
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
|
@@ -118,11 +117,12 @@ email:
|
|
118
117
|
executables: []
|
119
118
|
extensions: []
|
120
119
|
extra_rdoc_files:
|
121
|
-
- README.md
|
122
120
|
- LICENSE
|
121
|
+
- README.md
|
123
122
|
files:
|
124
123
|
- ".eslintrc"
|
125
124
|
- ".github/workflows/js_tests.yml"
|
125
|
+
- ".github/workflows/release.yml"
|
126
126
|
- ".github/workflows/ruby_tests.yml"
|
127
127
|
- ".gitignore"
|
128
128
|
- ".prettierrc"
|
@@ -626,7 +626,6 @@ homepage: https://github.com/theforeman/foreman-tasks
|
|
626
626
|
licenses:
|
627
627
|
- GPL-3.0
|
628
628
|
metadata: {}
|
629
|
-
post_install_message:
|
630
629
|
rdoc_options: []
|
631
630
|
require_paths:
|
632
631
|
- lib
|
@@ -641,8 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
641
640
|
- !ruby/object:Gem::Version
|
642
641
|
version: '0'
|
643
642
|
requirements: []
|
644
|
-
rubygems_version: 3.
|
645
|
-
signing_key:
|
643
|
+
rubygems_version: 3.6.7
|
646
644
|
specification_version: 4
|
647
645
|
summary: Foreman plugin for showing tasks information for resources and users
|
648
646
|
test_files:
|