foreman-tasks 9.2.3 → 10.0.0

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: 9cd550a681ae53c5133f3017a5f8bee019a119cd0bdfb23d8b64c830304cd5c1
4
- data.tar.gz: 195c7013c5c9c7ad31064cf3552fe10f6084a100b2903dc1753e10c62f2ef31f
3
+ metadata.gz: 12c497c315d4ddc13756f00588584ebbb26fd0320231cc2e6a2b5e1e285ad1c6
4
+ data.tar.gz: 404c59c211805039713e0d61411a649d21f318ad9f5e4a1f7872f2d2633dd3c4
5
5
  SHA512:
6
- metadata.gz: 93df3af963db3e2ac838954834bd54ef3d2ac21778fc1940bdb7971bb2f2de9e0bd7ed4abe6f7cbf9338cd636f7f3d4160b3eec25ca5eb5c7ca1586479fe13c1
7
- data.tar.gz: 9c13f2ad52f111a01c501294f3a43e75188401b2d48fecaa39fdea214db3ea8ac1751828d5ce27d8c564a53741ffceff121cf3c0d918f3f5d41d890a66f43fcb
6
+ metadata.gz: 831bfb836cedcf996170dcb23db17edc1fb9c3606130cb0f1c8c946de3164e7a9059ef61e6bbf5fdde4fb3febe1cc6cd5e07c668f891dfda51926b89b5da6f3e
7
+ data.tar.gz: e63d4cb1e9f172ff81bae074a6bba0abbb96b1c67369506e6e8a134f42fc161c46236d505ba4503ef8e9805a7ecf9015bb963b98c7bf78a5f88b4777c1345471
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
-
5
- gem 'theforeman-rubocop', '~> 0.1.0'
@@ -1,6 +1,6 @@
1
1
  module Actions
2
2
  module Middleware
3
- class KeepCurrentRequestID < Dynflow::Middleware
3
+ class KeepCurrentRequestId < Dynflow::Middleware
4
4
  def delay(*args)
5
5
  pass(*args).tap { store_current_request_id }
6
6
  end
@@ -33,4 +33,5 @@ same resource. It also optionally provides Dynflow infrastructure for using it f
33
33
 
34
34
  s.add_development_dependency 'factory_bot_rails', '~> 4.8.0'
35
35
  s.add_development_dependency 'sqlite3'
36
+ s.add_development_dependency 'theforeman-rubocop', '~> 0.1.0'
36
37
  end
@@ -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 |_app|
20
- Foreman::Plugin.register :"foreman-tasks" do
21
- requires_foreman '>= 3.9'
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
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
- 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 } })
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
- 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
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
- register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
113
+ register_graphql_mutation_field :cancel_recurring_logic, '::Mutations::RecurringLogics::Cancel'
113
114
 
114
- logger :dynflow, :enabled => true
115
- logger :action, :enabled => true
115
+ logger :dynflow, :enabled => true
116
+ logger :action, :enabled => true
116
117
 
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'
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
- 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')
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
- register_gettext domain: "foreman_tasks"
126
+ register_gettext domain: "foreman_tasks"
126
127
 
127
- ForemanTasks.dynflow.eager_load_actions!
128
- extend_observable_events(::Dynflow::Action.descendants.select { |klass| klass <= ::Actions::ObservableAction }.map(&:namespaced_event_names))
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::KeepCurrentRequestID
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
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '9.2.3'.freeze
2
+ VERSION = '10.0.0'.freeze
3
3
  end
@@ -8,8 +8,6 @@ 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
- puts "writing action translations to: #{storage_file}"
12
-
13
11
  klasses = Actions::EntryAction
14
12
  .subclasses
15
13
  .uniq
@@ -18,12 +16,19 @@ if gettext_find_task
18
16
  src.start_with? @engine.root.to_s
19
17
  end
20
18
 
21
- File.write storage_file,
22
- "# Autogenerated!\n" +
23
- klasses
24
- .map { |klass| %[_("#{klass.allocate.humanized_name}")] }
25
- .sort
26
- .join("\n") + "\n"
19
+ if klasses.any?
20
+ puts "writing action translations to: #{storage_file}"
21
+
22
+ File.write storage_file,
23
+ "# Autogenerated!\n" +
24
+ klasses
25
+ .map { |klass| %[_("#{klass.allocate.humanized_name}")] }
26
+ .sort
27
+ .join("\n") + "\n"
28
+ elsif File.exist? storage_file
29
+ puts "Removing empty action translations file: #{storage_file}"
30
+ File.delete storage_file
31
+ end
27
32
  end
28
33
  end
29
34
 
@@ -1,9 +1,9 @@
1
1
  require 'foreman_tasks_test_helper'
2
2
 
3
3
  module ForemanTasks
4
- class KeepCurrentRequestIDTest < ActiveSupport::TestCase
4
+ class KeepCurrentRequestIdTest < ActiveSupport::TestCase
5
5
  class DummyAction < Actions::EntryAction
6
- middleware.use ::Actions::Middleware::KeepCurrentRequestID
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::KeepCurrentRequestID do
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: 9.2.3
4
+ version: 10.0.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-07-24 00:00:00.000000000 Z
11
+ date: 2024-09-10 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