foreman-tasks 9.2.3 → 10.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/.gitignore +1 -0
- data/Gemfile +0 -2
- data/app/lib/actions/middleware/keep_current_request_id.rb +1 -1
- data/foreman-tasks.gemspec +1 -0
- data/lib/foreman_tasks/cleaner.rb +1 -1
- data/lib/foreman_tasks/engine.rb +104 -102
- data/lib/foreman_tasks/tasks/export_tasks.rake +3 -3
- data/lib/foreman_tasks/version.rb +1 -1
- data/lib/tasks/gettext.rake +25 -14
- data/test/lib/actions/middleware/keep_current_request_id_test.rb +3 -3
- metadata +16 -3
- data/locale/action_names.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7506ccab551c52f9408df7fcfca78e6a565753bc35ca7263bd2265a5aa95bf
|
4
|
+
data.tar.gz: 2a6a714e7cfc082139d7fd73f1f7c2547817e4e9ace0b02c681bad6b8f63043b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1f0897789b528c739a77a21b39b2471f841759472c2755228b288e698485c11aee37224106c96725cd858d98c970fbe71948adceeb1553b83931a75e817676
|
7
|
+
data.tar.gz: fe5eb0b8a95b15ada47a46b4839c79e5b45d43042a28ca13fd1ad318a1dbeb7afe0257138eea96b3006613baf4fe0ec7d51c98854347b1a5f908cea6eefabf77
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/foreman-tasks.gemspec
CHANGED
@@ -252,7 +252,7 @@ module ForemanTasks
|
|
252
252
|
|
253
253
|
def prepare_filter
|
254
254
|
filter_parts = [filter]
|
255
|
-
filter_parts << %(started_at < "#{after.ago.
|
255
|
+
filter_parts << %(started_at < "#{after.ago.to_formatted_s(:db)}") if after > 0
|
256
256
|
filter_parts << "state ^ (#{states.join(',')})" if states.any?
|
257
257
|
filter_parts.select(&:present?).map { |segment| "(#{segment})" }.join(' AND ')
|
258
258
|
end
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -16,116 +16,118 @@ 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
|
-
|
19
|
+
initializer 'foreman_tasks.register_plugin', :before => :finisher_hook do |app|
|
20
|
+
app.reloader.to_prepare do
|
21
|
+
Foreman::Plugin.register :"foreman-tasks" do
|
22
|
+
requires_foreman '>= 3.13'
|
23
|
+
divider :top_menu, :parent => :monitor_menu, :last => true, :caption => N_('Foreman Tasks')
|
24
|
+
menu :top_menu, :tasks,
|
25
|
+
:url_hash => { :controller => 'foreman_tasks/tasks', :action => :index },
|
26
|
+
:caption => N_('Tasks'),
|
27
|
+
:parent => :monitor_menu,
|
28
|
+
:last => true
|
29
|
+
|
30
|
+
menu :top_menu, :recurring_logics,
|
31
|
+
:url_hash => { :controller => 'foreman_tasks/recurring_logics', :action => :index },
|
32
|
+
:caption => N_('Recurring Logics'),
|
33
|
+
:parent => :monitor_menu,
|
34
|
+
:last => true
|
35
|
+
|
36
|
+
security_block :foreman_tasks do |_map|
|
37
|
+
permission :view_foreman_tasks, { :'foreman_tasks/tasks' => [:auto_complete_search, :sub_tasks, :index, :summary, :summary_sub_tasks, :show],
|
38
|
+
:'foreman_tasks/react' => [:index],
|
39
|
+
:'foreman_tasks/api/tasks' => [:bulk_search, :show, :index, :summary, :summary_sub_tasks, :details, :sub_tasks] }, :resource_type => 'ForemanTasks::Task'
|
40
|
+
permission :edit_foreman_tasks, { :'foreman_tasks/tasks' => [:resume, :unlock, :force_unlock, :cancel_step, :cancel, :abort],
|
41
|
+
:'foreman_tasks/api/tasks' => [:bulk_resume, :bulk_cancel, :bulk_stop] }, :resource_type => 'ForemanTasks::Task'
|
42
|
+
|
43
|
+
permission :create_recurring_logics, {}, :resource_type => 'ForemanTasks::RecurringLogic'
|
44
|
+
|
45
|
+
permission :view_recurring_logics, { :'foreman_tasks/recurring_logics' => [:auto_complete_search, :index, :show],
|
46
|
+
:'foreman_tasks/api/recurring_logics' => [:index, :show] }, :resource_type => 'ForemanTasks::RecurringLogic'
|
47
|
+
|
48
|
+
permission :edit_recurring_logics, { :'foreman_tasks/recurring_logics' => [:cancel, :enable, :disable, :clear_cancelled],
|
49
|
+
:'foreman_tasks/api/recurring_logics' => [:cancel, :update, :bulk_destroy] }, :resource_type => 'ForemanTasks::RecurringLogic'
|
50
|
+
end
|
50
51
|
|
51
|
-
|
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
|
-
|
52
|
+
add_all_permissions_to_default_roles
|
53
|
+
|
54
|
+
settings do
|
55
|
+
category(:tasks, N_('Tasks')) do
|
56
|
+
setting('foreman_tasks_sync_task_timeout',
|
57
|
+
type: :integer,
|
58
|
+
description: N_('Number of seconds to wait for synchronous task to finish.'),
|
59
|
+
default: 120,
|
60
|
+
full_name: N_('Sync task timeout'))
|
61
|
+
setting('dynflow_enable_console',
|
62
|
+
type: :boolean,
|
63
|
+
description: N_('Enable the dynflow console (/foreman_tasks/dynflow) for debugging'),
|
64
|
+
default: true,
|
65
|
+
full_name: N_('Enable dynflow console'))
|
66
|
+
setting('dynflow_console_require_auth',
|
67
|
+
type: :boolean,
|
68
|
+
description: N_('Require user to be authenticated as user with admin rights when accessing dynflow console'),
|
69
|
+
default: true,
|
70
|
+
full_name: N_('Require auth for dynflow console'))
|
71
|
+
setting('foreman_tasks_proxy_action_retry_count',
|
72
|
+
type: :integer,
|
73
|
+
description: N_('Number of attempts to start a task on the smart proxy before failing'),
|
74
|
+
default: 4,
|
75
|
+
full_name: N_('Proxy action retry count'))
|
76
|
+
setting('foreman_tasks_proxy_action_retry_interval',
|
77
|
+
type: :integer,
|
78
|
+
description: N_('Time in seconds between retries'),
|
79
|
+
default: 15,
|
80
|
+
full_name: N_('Proxy action retry interval'))
|
81
|
+
setting('foreman_tasks_proxy_batch_trigger',
|
82
|
+
type: :boolean,
|
83
|
+
description: N_('Allow triggering tasks on the smart proxy in batches'),
|
84
|
+
default: true,
|
85
|
+
full_name: N_('Allow proxy batch tasks'))
|
86
|
+
setting('foreman_tasks_proxy_batch_size',
|
87
|
+
type: :integer,
|
88
|
+
description: N_('Number of tasks which should be sent to the smart proxy in one request, if foreman_tasks_proxy_batch_trigger is enabled'),
|
89
|
+
default: 100,
|
90
|
+
full_name: N_('Proxy tasks batch size'))
|
91
|
+
setting('foreman_tasks_troubleshooting_url',
|
92
|
+
type: :string,
|
93
|
+
description: N_('Url pointing to the task troubleshooting documentation. '\
|
94
|
+
'It should contain %{label} placeholder, that will be replaced with normalized task label '\
|
95
|
+
'(restricted to only alphanumeric characters)). %{version} placeholder is also available.'),
|
96
|
+
default: nil,
|
97
|
+
full_name: N_('Tasks troubleshooting URL'))
|
98
|
+
setting('foreman_tasks_polling_multiplier',
|
99
|
+
type: :integer,
|
100
|
+
description: N_('Polling multiplier which is used to multiply the default polling intervals. '\
|
101
|
+
'This can be used to prevent polling too frequently for long running tasks.'),
|
102
|
+
default: 1,
|
103
|
+
full_name: N_("Polling intervals multiplier"),
|
104
|
+
validate: { numericality: { greater_than: 0 } })
|
105
|
+
end
|
104
106
|
end
|
105
|
-
end
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
register_graphql_query_field :task, '::Types::Task', :record_field
|
109
|
+
register_graphql_query_field :tasks, '::Types::Task', :collection_field
|
110
|
+
register_graphql_query_field :recurring_logic, '::Types::RecurringLogic', :record_field
|
111
|
+
register_graphql_query_field :recurring_logics, '::Types::RecurringLogic', :collection_field
|
111
112
|
|
112
|
-
|
113
|
+
register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
|
113
114
|
|
114
|
-
|
115
|
-
|
115
|
+
logger :dynflow, :enabled => true
|
116
|
+
logger :action, :enabled => true
|
116
117
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
role 'Tasks Manager', [:view_foreman_tasks, :edit_foreman_tasks],
|
119
|
+
'Role granting permissions to inspect, cancel, resume and unlock tasks'
|
120
|
+
role 'Tasks Reader', [:view_foreman_tasks],
|
121
|
+
'Role granting permissions to inspect tasks'
|
121
122
|
|
122
|
-
|
123
|
-
|
123
|
+
widget 'foreman_tasks/tasks/dashboard/tasks_status', :sizex => 6, :sizey => 1, :name => N_('Task Status')
|
124
|
+
widget 'foreman_tasks/tasks/dashboard/latest_tasks_in_error_warning', :sizex => 6, :sizey => 1, :name => N_('Latest Warning/Error Tasks')
|
124
125
|
|
125
|
-
|
126
|
+
register_gettext domain: "foreman_tasks"
|
126
127
|
|
127
|
-
|
128
|
-
|
128
|
+
ForemanTasks.dynflow.eager_load_actions!
|
129
|
+
extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
|
130
|
+
end
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
@@ -160,7 +162,7 @@ module ForemanTasks
|
|
160
162
|
world.middleware.use Actions::Middleware::KeepCurrentTaxonomies
|
161
163
|
world.middleware.use Actions::Middleware::KeepCurrentUser, :before => ::Dynflow::Middleware::Common::Transaction
|
162
164
|
world.middleware.use Actions::Middleware::KeepCurrentTimezone
|
163
|
-
world.middleware.use Actions::Middleware::
|
165
|
+
world.middleware.use Actions::Middleware::KeepCurrentRequestId
|
164
166
|
world.middleware.use ::Actions::Middleware::LoadSettingValues
|
165
167
|
ForemanTasks.register_scheduled_task(Actions::CheckLongRunningTasks, ENV['FOREMAN_TASKS_CHECK_LONG_RUNNING_TASKS_CRONLINE'] || '0 0 * * *')
|
166
168
|
end
|
@@ -310,15 +310,15 @@ namespace :foreman_tasks do
|
|
310
310
|
SKIP_ERRORS = ['true', '1', 'y', 'yes'].include? (ENV['SKIP_FAILED'] || '').downcase
|
311
311
|
|
312
312
|
filter = if ENV['TASK_SEARCH'].nil? && ENV['TASK_DAYS'].nil?
|
313
|
-
"started_at > \"#{7.days.ago.
|
314
|
-
"(result != success && started_at > \"#{60.days.ago.
|
313
|
+
"started_at > \"#{7.days.ago.to_formatted_s(:db)}\" || " \
|
314
|
+
"(result != success && started_at > \"#{60.days.ago.to_formatted_s(:db)})\""
|
315
315
|
else
|
316
316
|
ENV['TASK_SEARCH'] || ''
|
317
317
|
end
|
318
318
|
|
319
319
|
if (days = ENV['TASK_DAYS'])
|
320
320
|
filter += ' && ' unless filter == ''
|
321
|
-
filter += "started_at > \"#{days.to_i.days.ago.
|
321
|
+
filter += "started_at > \"#{days.to_i.days.ago.to_formatted_s(:db)}\""
|
322
322
|
end
|
323
323
|
|
324
324
|
format = ENV['TASK_FORMAT'] || 'html'
|
data/lib/tasks/gettext.rake
CHANGED
@@ -8,22 +8,33 @@ if gettext_find_task
|
|
8
8
|
namespace :gettext do
|
9
9
|
task :store_action_names => :environment do
|
10
10
|
storage_file = "#{locale_path}/action_names.rb"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
method_names = [:plan, :run, :finalize]
|
12
|
+
instances = Actions::EntryAction
|
13
|
+
.descendants
|
14
|
+
.uniq
|
15
|
+
.map(&:allocate)
|
16
|
+
.select do |action|
|
17
|
+
method_names.any? do |method_name|
|
18
|
+
if action.respond_to?(method_name)
|
19
|
+
src, = action.method(method_name).source_location
|
20
|
+
src.start_with? @engine.root.to_s
|
21
|
+
end
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
if instances.any?
|
26
|
+
puts "writing action translations to: #{storage_file}"
|
27
|
+
|
28
|
+
File.write storage_file,
|
29
|
+
"# Autogenerated!\n" +
|
30
|
+
instances
|
31
|
+
.map { |instance| %[_("#{instance.humanized_name}")] }
|
32
|
+
.sort
|
33
|
+
.join("\n") + "\n"
|
34
|
+
elsif File.exist? storage_file
|
35
|
+
puts "Removing empty action translations file: #{storage_file}"
|
36
|
+
File.delete storage_file
|
37
|
+
end
|
27
38
|
end
|
28
39
|
end
|
29
40
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'foreman_tasks_test_helper'
|
2
2
|
|
3
3
|
module ForemanTasks
|
4
|
-
class
|
4
|
+
class KeepCurrentRequestIdTest < ActiveSupport::TestCase
|
5
5
|
class DummyAction < Actions::EntryAction
|
6
|
-
middleware.use ::Actions::Middleware::
|
6
|
+
middleware.use ::Actions::Middleware::KeepCurrentRequestId
|
7
7
|
|
8
8
|
def plan(plan = false)
|
9
9
|
plan_self if plan
|
@@ -18,7 +18,7 @@ module ForemanTasks
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe Actions::Middleware::
|
21
|
+
describe Actions::Middleware::KeepCurrentRequestId do
|
22
22
|
include ::Dynflow::Testing
|
23
23
|
|
24
24
|
before { @old_id = ::Logging.mdc['request'] }
|
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:
|
4
|
+
version: 10.0.1
|
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-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: theforeman-rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.1.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.1.0
|
97
111
|
description: |
|
98
112
|
The goal of this plugin is to unify the way of showing task statuses across the Foreman instance.
|
99
113
|
It defines Task model for keeping the information about the tasks and Lock for assigning the tasks
|
@@ -304,7 +318,6 @@ files:
|
|
304
318
|
- lib/foreman_tasks/version.rb
|
305
319
|
- lib/tasks/gettext.rake
|
306
320
|
- locale/Makefile
|
307
|
-
- locale/action_names.rb
|
308
321
|
- locale/de/LC_MESSAGES/foreman_tasks.mo
|
309
322
|
- locale/de/foreman_tasks.po
|
310
323
|
- locale/en/LC_MESSAGES/foreman_tasks.mo
|