foreman-tasks 7.1.0 → 7.2.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/js_tests.yml +3 -1
  3. data/app/lib/actions/foreman/host/import_facts.rb +1 -6
  4. data/app/models/foreman_tasks/task/dynflow_task.rb +10 -5
  5. data/app/views/foreman_tasks/recurring_logics/index.html.erb +1 -1
  6. data/lib/foreman_tasks/cleaner.rb +1 -1
  7. data/lib/foreman_tasks/dynflow/configuration.rb +1 -1
  8. data/lib/foreman_tasks/engine.rb +4 -1
  9. data/lib/foreman_tasks/version.rb +1 -1
  10. data/lib/tasks/gettext.rake +1 -0
  11. data/locale/action_names.rb +2 -3
  12. data/locale/de/LC_MESSAGES/foreman_tasks.mo +0 -0
  13. data/locale/de/foreman_tasks.po +873 -0
  14. data/locale/en/LC_MESSAGES/foreman_tasks.mo +0 -0
  15. data/locale/en/foreman_tasks.po +4 -7
  16. data/locale/es/LC_MESSAGES/foreman_tasks.mo +0 -0
  17. data/locale/es/foreman_tasks.po +874 -0
  18. data/locale/foreman_tasks.pot +20 -25
  19. data/locale/fr/LC_MESSAGES/foreman_tasks.mo +0 -0
  20. data/locale/fr/foreman_tasks.po +71 -72
  21. data/locale/ja/LC_MESSAGES/foreman_tasks.mo +0 -0
  22. data/locale/ja/foreman_tasks.po +70 -74
  23. data/locale/ka/LC_MESSAGES/foreman_tasks.mo +0 -0
  24. data/locale/ka/foreman_tasks.po +871 -0
  25. data/locale/ko/LC_MESSAGES/foreman_tasks.mo +0 -0
  26. data/locale/ko/foreman_tasks.po +869 -0
  27. data/locale/pt_BR/LC_MESSAGES/foreman_tasks.mo +0 -0
  28. data/locale/pt_BR/foreman_tasks.po +874 -0
  29. data/locale/ru/LC_MESSAGES/foreman_tasks.mo +0 -0
  30. data/locale/ru/foreman_tasks.po +873 -0
  31. data/locale/zh_CN/LC_MESSAGES/foreman_tasks.mo +0 -0
  32. data/locale/zh_CN/foreman_tasks.po +157 -161
  33. data/locale/zh_TW/LC_MESSAGES/foreman_tasks.mo +0 -0
  34. data/locale/zh_TW/foreman_tasks.po +870 -0
  35. data/test/unit/task_test.rb +5 -8
  36. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b653c4a46abfb110f3a5c1ff0f130814110475989e364d39aa2756bc76c4ae2
4
- data.tar.gz: b7ad044c96a9cd2f7f7dbf10416ce42b88e5f2ddaf4fe5cbed696cfde39dee32
3
+ metadata.gz: c5d611523d1262879b33177bf9c1f4c394142fee8433c2fda798cb4063b60f99
4
+ data.tar.gz: 1e7974c6fde725d0fe46dcffd6793c7f4b078c3c6e2e3429dce42180e61e4044
5
5
  SHA512:
6
- metadata.gz: b0525a6e659bf05476e86b69c6147600463f16274e71fc15b1ccee628011a785dc53fc6b8cad0ef5f3439cac8c6581a73cea7a1175c4489778f5204fe3914c76
7
- data.tar.gz: feab08efc57055c27fab6010dd1f5dac438f74091dee9c239da5722a7236eacf467433f17838066e3ef707f2268e39e2f3130615a25a9094286a9c65d66b2485
6
+ metadata.gz: 6f358b767cf2c8f2f6d31a43aa6c1fca27a6db053311d4540cea15d11c7c76758db192d5b39ecef17fcfc9d89e9e99a233c6b3d14fadd41efcca709aea37704b
7
+ data.tar.gz: 9c08bf19e2f8bdc05add76a9b8e9b783407b03ba99f0c47325454468a4654e44296f8dafd87e40a5d58ed771edb58900c0ac41738202efce5043193b5580a50c
@@ -12,7 +12,9 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- node-version: [10, 12]
15
+ node-version:
16
+ - 12
17
+ - 14
16
18
  steps:
17
19
  - uses: actions/checkout@v2
18
20
  - name: Setup Node
@@ -8,12 +8,7 @@ module Actions
8
8
 
9
9
  def plan(_host_type, host_name, facts, certname, proxy_id)
10
10
  facts['domain'].try(:downcase!)
11
- host = if SETTINGS[:version].short > '1.16'
12
- ::Host::Managed.import_host(host_name, certname)
13
- else
14
- # backwards compatibility
15
- ::Host::Managed.import_host(host_name, facts['_type'], certname, proxy_id)
16
- end
11
+ host = ::Host::Managed.import_host(host_name, certname)
17
12
  host.save(:validate => false) if host.new_record?
18
13
  action_subject(host, :facts => facts.to_unsafe_h, :proxy_id => proxy_id)
19
14
  if host.build?
@@ -219,19 +219,24 @@ module ForemanTasks
219
219
  def self.consistency_check
220
220
  fixed_count = 0
221
221
  logger = Foreman::Logging.logger('foreman-tasks')
222
- running.each do |task|
223
- changes = task.update_from_dynflow(task.execution_plan)
222
+
223
+ # Dynflow execution plans which are not stopped at this point should
224
+ # eventually get moving and their tasks should eventually get back in sync
225
+ # as the execution plans run
226
+ joins('LEFT JOIN dynflow_execution_plans ON foreman_tasks_tasks.external_id = dynflow_execution_plans.uuid::varchar')
227
+ .where('foreman_tasks_tasks.state_updated_at < dynflow_execution_plans.ended_at')
228
+ .find_each do |task|
229
+ changes = task.update_from_dynflow(task.execution_plan.to_hash)
224
230
  unless changes.empty?
225
231
  fixed_count += 1
226
232
  logger.warn('Task %s updated at consistency check: %s' % [task.id, changes.inspect])
227
233
  end
228
234
  rescue => e
229
- # if we fail updating the data from dynflow, it usually means there is something
230
- # odd with the data consistency and at this point it is not possible to resume, switching
231
- # the task to stopped/error
232
235
  task.update(:state => 'stopped', :result => 'error')
233
236
  Foreman::Logging.exception("Failed at consistency check for task #{task.id}", e, :logger => 'foreman-tasks')
234
237
  end
238
+ # Wipe tasks left behind by now stopped tasks
239
+ ForemanTasks::Lock.left_joins(:task).merge(where(:state => 'stopped')).destroy_all
235
240
  fixed_count
236
241
  end
237
242
 
@@ -1,5 +1,5 @@
1
1
  <% title _("Recurring logics") %>
2
- <% title_actions SETTINGS[:version].short <= '1.13' ? help_path : help_button %>
2
+ <% title_actions help_button %>
3
3
 
4
4
  <% if @errors %>
5
5
  <%= alert(:class => 'alert-info', :id => 'multiple-alert', :close => false, :header => '', :text => @errors) %>
@@ -84,7 +84,7 @@ module ForemanTasks
84
84
 
85
85
  def self.cleanup_settings
86
86
  return @cleanup_settings if @cleanup_settings
87
- @cleanup_settings = SETTINGS[:'foreman-tasks'] && SETTINGS[:'foreman-tasks'][:cleanup] || {}
87
+ @cleanup_settings = SETTINGS.dig(:'foreman-tasks', :cleanup) || {}
88
88
  end
89
89
 
90
90
  def self.actions_by_rules(action_rules)
@@ -16,7 +16,7 @@ module ForemanTasks
16
16
  :backup_deleted_plans => true,
17
17
  :backup_dir => default_backup_dir,
18
18
  }
19
- settings = SETTINGS[:'foreman-tasks'] && SETTINGS[:'foreman-tasks'][:backup]
19
+ settings = SETTINGS.dig(:'foreman-tasks', :backup)
20
20
  backup_options.merge!(settings) if settings
21
21
  @backup_settings = with_environment_override backup_options
22
22
  end
@@ -166,7 +166,10 @@ module ForemanTasks
166
166
  world.middleware.use Actions::Middleware::KeepCurrentUser, :before => ::Dynflow::Middleware::Common::Transaction
167
167
  world.middleware.use Actions::Middleware::KeepCurrentTimezone
168
168
  world.middleware.use Actions::Middleware::KeepCurrentRequestID
169
- world.middleware.use ::Actions::Middleware::LoadSettingValues if Gem::Version.new(::SETTINGS[:version]) >= Gem::Version.new('2.5')
169
+ world.middleware.use ::Actions::Middleware::LoadSettingValues
170
+ end
171
+ ::ForemanTasks.dynflow.config.on_init(true) do
172
+ ::ForemanTasks::Task::DynflowTask.consistency_check
170
173
  end
171
174
  end
172
175
 
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '7.1.0'.freeze
2
+ VERSION = '7.2.0'.freeze
3
3
  end
@@ -16,6 +16,7 @@ if gettext_find_task
16
16
  .all_action_names
17
17
  .uniq
18
18
  .map { |n| %[_("#{n}")] }
19
+ .sort
19
20
  .join("\n")
20
21
  end
21
22
  end
@@ -1,5 +1,4 @@
1
1
  # Autogenerated!
2
- _("Import Puppet classes")
3
- _("Import facts")
4
2
  _("Action with sub plans")
5
- _("Remote action:")
3
+ _("Import Puppet classes")
4
+ _("Import facts")