foreman-tasks 5.2.2 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_tests.yml +7 -18
- data/.rubocop.yml +1 -0
- data/app/lib/actions/base.rb +1 -0
- data/app/lib/actions/foreman/host/import_facts.rb +1 -1
- data/app/lib/actions/helpers/lifecycle_logging.rb +1 -1
- data/app/lib/actions/middleware/rails_executor_wrap.rb +2 -2
- data/app/lib/actions/middleware/watch_delegated_proxy_sub_tasks.rb +18 -11
- data/app/lib/actions/proxy_action.rb +2 -2
- data/app/lib/actions/task_synchronization.rb +65 -0
- data/app/lib/actions/trigger_proxy_batch.rb +1 -1
- data/app/models/foreman_tasks/lock.rb +1 -1
- data/app/models/foreman_tasks/remote_task.rb +10 -3
- data/app/models/foreman_tasks/task/dynflow_task.rb +20 -21
- data/app/views/foreman_tasks/api/locks/show.json.rabl +4 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20210708123832_add_parent_task_id_to_remote_tasks.foreman_tasks.rb +5 -0
- data/db/migrate/20211123170430_tasks_settings_to_dsl_category.rb +5 -0
- data/foreman-tasks.gemspec +1 -1
- data/lib/foreman_tasks/dynflow/configuration.rb +1 -6
- data/lib/foreman_tasks/dynflow.rb +1 -1
- data/lib/foreman_tasks/engine.rb +56 -9
- data/lib/foreman_tasks/test_helpers.rb +1 -1
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +2 -3
- data/locale/en/foreman_tasks.po +27 -3
- data/locale/foreman_tasks.pot +230 -176
- data/locale/fr/foreman_tasks.po +27 -3
- data/locale/ja/foreman_tasks.po +27 -3
- data/locale/zh_CN/foreman_tasks.po +27 -3
- data/test/controllers/api/tasks_controller_test.rb +1 -2
- data/test/factories/task_factory.rb +1 -1
- data/test/lib/actions/middleware/keep_current_taxonomies_test.rb +9 -1
- data/test/support/dummy_dynflow_action.rb +1 -1
- data/test/support/dummy_proxy_action.rb +1 -1
- data/test/unit/actions/proxy_action_test.rb +19 -13
- data/test/unit/actions/trigger_proxy_batch_test.rb +0 -1
- data/test/unit/troubleshooting_help_generator_test.rb +0 -1
- data/test/unit/ui_notifications_test.rb +0 -1
- data/webpack/ForemanTasks/Components/TaskActions/TaskActionHelpers.js +1 -1
- data/webpack/ForemanTasks/Components/TaskActions/index.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Locks.js +28 -14
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Locks.test.js.snap +50 -42
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/TasksBulkActions.js +1 -1
- data/webpack/ForemanTasks/Components/TasksTable/TasksTable.js +2 -28
- data/webpack/ForemanTasks/Components/TasksTable/TasksTablePage.js +5 -9
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableReducer.js +1 -5
- data/webpack/ForemanTasks/Components/TasksTable/TasksTableSelectors.js +2 -2
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/TasksTable.fixtures.js +1 -4
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/SubTasksPage.test.js.snap +1 -6
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksIndexPage.test.js.snap +1 -6
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTable.test.js.snap +2 -22
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTablePage.test.js.snap +2 -12
- data/webpack/ForemanTasks/Components/TasksTable/__tests__/__snapshots__/TasksTableReducer.test.js.snap +1 -4
- data/webpack/ForemanTasks/Components/TasksTable/index.js +2 -2
- data/webpack/__mocks__/foremanReact/components/Pagination/index.js +2 -0
- data/webpack/__mocks__/foremanReact/{redux/actions/toasts.js → components/ToastsList/index.js} +0 -0
- metadata +8 -7
- data/app/models/setting/foreman_tasks.rb +0 -29
- data/lib/foreman_tasks/dynflow/persistence.rb +0 -46
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
data/locale/fr/foreman_tasks.po
CHANGED
@@ -57,6 +57,9 @@ msgstr "Le paramètre :after dans la section de nettoyage des tâches est obsol
|
|
57
57
|
msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
|
58
58
|
msgstr "Une tâche en pause représente un processus qui ne s'est pas terminé correctement. Toute tâche en état de pause peut entraîner une incohérence potentielle et doit être résolue."
|
59
59
|
|
60
|
+
msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
|
61
|
+
msgstr ""
|
62
|
+
|
60
63
|
msgid "Action"
|
61
64
|
msgstr "Action"
|
62
65
|
|
@@ -69,6 +72,9 @@ msgstr "Actif"
|
|
69
72
|
msgid "Active Filters:"
|
70
73
|
msgstr "Filtres actifs :"
|
71
74
|
|
75
|
+
msgid "Active or disabled recurring logic with purpose %s already exists"
|
76
|
+
msgstr ""
|
77
|
+
|
72
78
|
msgid "All %s tasks are selected. "
|
73
79
|
msgstr "Toutes les tâches %s sont sélectionnées. "
|
74
80
|
|
@@ -277,6 +283,9 @@ msgstr "Tâches Foreman"
|
|
277
283
|
msgid "Fri"
|
278
284
|
msgstr "Ven."
|
279
285
|
|
286
|
+
msgid "I understand that this may cause harm and have working database backups of all backend services."
|
287
|
+
msgstr ""
|
288
|
+
|
280
289
|
msgid "ID"
|
281
290
|
msgstr "ID"
|
282
291
|
|
@@ -428,9 +437,6 @@ msgstr "Multiplicateur des intervalles de sondage"
|
|
428
437
|
msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
|
429
438
|
msgstr "Multiplicateur de sondage qui est utilisé pour multiplier les intervalles de sondage par défaut. Il peut être utilisé pour éviter que les sondages ne soient trop fréquents pour des tâches de longue durée."
|
430
439
|
|
431
|
-
msgid "Preupgrade job"
|
432
|
-
msgstr ""
|
433
|
-
|
434
440
|
msgid "Proxy action retry count"
|
435
441
|
msgstr ""
|
436
442
|
|
@@ -443,6 +449,9 @@ msgstr "Tâches de proxy manquantes du smart proxy"
|
|
443
449
|
msgid "Proxy tasks batch size"
|
444
450
|
msgstr ""
|
445
451
|
|
452
|
+
msgid "Purpose"
|
453
|
+
msgstr ""
|
454
|
+
|
446
455
|
msgid "Raw"
|
447
456
|
msgstr "Brut"
|
448
457
|
|
@@ -488,6 +497,9 @@ msgstr "Le verrouillage requis est déjà utilisé par d'autres tâches en cours
|
|
488
497
|
msgid "Resource search_params requires resource_type and resource_id to be specified"
|
489
498
|
msgstr "Ressource search_params a besoin que resource_type et resource_id soient spécifiés"
|
490
499
|
|
500
|
+
msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
|
501
|
+
msgstr ""
|
502
|
+
|
491
503
|
msgid "Result"
|
492
504
|
msgstr "Résultat"
|
493
505
|
|
@@ -664,6 +676,12 @@ msgstr[1] "Il y a %{compte} de tâches en pause dans le système qui nécessiten
|
|
664
676
|
msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
|
665
677
|
msgstr "Cette action supprimera toutes les logiques récurrentes annulées. Veuillez noter que cette action ne peut pas être annulée."
|
666
678
|
|
679
|
+
msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
|
680
|
+
msgstr ""
|
681
|
+
|
682
|
+
msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
|
683
|
+
msgstr ""
|
684
|
+
|
667
685
|
msgid "Thu"
|
668
686
|
msgstr "Jeu."
|
669
687
|
|
@@ -718,6 +736,9 @@ msgstr "En se concentrant sur la dernière"
|
|
718
736
|
msgid "Yes"
|
719
737
|
msgstr "Oui"
|
720
738
|
|
739
|
+
msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
|
740
|
+
msgstr ""
|
741
|
+
|
721
742
|
msgid "You do not have permission"
|
722
743
|
msgstr ""
|
723
744
|
|
@@ -759,6 +780,9 @@ msgstr "est minute (plage: 0-59)"
|
|
759
780
|
msgid "is month (range: 1-12)"
|
760
781
|
msgstr "est mois (Plage: 1-12)"
|
761
782
|
|
783
|
+
msgid "is not a valid format"
|
784
|
+
msgstr ""
|
785
|
+
|
762
786
|
msgid "last"
|
763
787
|
msgstr "dernier"
|
764
788
|
|
data/locale/ja/foreman_tasks.po
CHANGED
@@ -57,6 +57,9 @@ msgstr "タスク消去のセクションの :after の設定は非推奨にな
|
|
57
57
|
msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
|
58
58
|
msgstr "一時停止タスクは、適切に終了していないプロセスを表します。一時停止状態のタスクは、一貫性に欠ける可能性があり、解決する必要があります。"
|
59
59
|
|
60
|
+
msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
|
61
|
+
msgstr ""
|
62
|
+
|
60
63
|
msgid "Action"
|
61
64
|
msgstr "アクション"
|
62
65
|
|
@@ -69,6 +72,9 @@ msgstr "アクティブ"
|
|
69
72
|
msgid "Active Filters:"
|
70
73
|
msgstr "アクティブなフィルター:"
|
71
74
|
|
75
|
+
msgid "Active or disabled recurring logic with purpose %s already exists"
|
76
|
+
msgstr ""
|
77
|
+
|
72
78
|
msgid "All %s tasks are selected. "
|
73
79
|
msgstr "%s の全タスクを選択します。"
|
74
80
|
|
@@ -277,6 +283,9 @@ msgstr "Foreman タスク"
|
|
277
283
|
msgid "Fri"
|
278
284
|
msgstr "金"
|
279
285
|
|
286
|
+
msgid "I understand that this may cause harm and have working database backups of all backend services."
|
287
|
+
msgstr ""
|
288
|
+
|
280
289
|
msgid "ID"
|
281
290
|
msgstr "ID"
|
282
291
|
|
@@ -428,9 +437,6 @@ msgstr "ポーリングの間隔乗数"
|
|
428
437
|
msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
|
429
438
|
msgstr "デフォルトのポーリングの間隔を乗算するときに使用するポーリング乗数。この乗数を使用して、長期間にわたり実行中のタスクが頻繁にポーリングされるのを回避します。"
|
430
439
|
|
431
|
-
msgid "Preupgrade job"
|
432
|
-
msgstr ""
|
433
|
-
|
434
440
|
msgid "Proxy action retry count"
|
435
441
|
msgstr ""
|
436
442
|
|
@@ -443,6 +449,9 @@ msgstr "Smart Proxy のプロキシータスクが見つかりません"
|
|
443
449
|
msgid "Proxy tasks batch size"
|
444
450
|
msgstr ""
|
445
451
|
|
452
|
+
msgid "Purpose"
|
453
|
+
msgstr ""
|
454
|
+
|
446
455
|
msgid "Raw"
|
447
456
|
msgstr "ロー"
|
448
457
|
|
@@ -488,6 +497,9 @@ msgstr "必要なロックは、実行中の他のタスクにより取得済み
|
|
488
497
|
msgid "Resource search_params requires resource_type and resource_id to be specified"
|
489
498
|
msgstr "リソース search_params では resource_type と resource_id を指定する必要があります"
|
490
499
|
|
500
|
+
msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
|
501
|
+
msgstr ""
|
502
|
+
|
491
503
|
msgid "Result"
|
492
504
|
msgstr "結果"
|
493
505
|
|
@@ -664,6 +676,12 @@ msgstr[1] ""
|
|
664
676
|
msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
|
665
677
|
msgstr "このアクションは、キャンセル済みの再帰論理をすべて削除します。この操作は元に戻すことはできません。注意してください。"
|
666
678
|
|
679
|
+
msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
|
680
|
+
msgstr ""
|
681
|
+
|
682
|
+
msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
|
683
|
+
msgstr ""
|
684
|
+
|
667
685
|
msgid "Thu"
|
668
686
|
msgstr "木"
|
669
687
|
|
@@ -718,6 +736,9 @@ msgstr "フォーカスする時間: 過去 "
|
|
718
736
|
msgid "Yes"
|
719
737
|
msgstr "はい"
|
720
738
|
|
739
|
+
msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
|
740
|
+
msgstr ""
|
741
|
+
|
721
742
|
msgid "You do not have permission"
|
722
743
|
msgstr ""
|
723
744
|
|
@@ -759,6 +780,9 @@ msgstr "分 (範囲: 0〜59)"
|
|
759
780
|
msgid "is month (range: 1-12)"
|
760
781
|
msgstr "月 (範囲: 1〜12)"
|
761
782
|
|
783
|
+
msgid "is not a valid format"
|
784
|
+
msgstr ""
|
785
|
+
|
762
786
|
msgid "last"
|
763
787
|
msgstr "過去"
|
764
788
|
|
@@ -56,6 +56,9 @@ msgstr ":在任务清理部分中的设置弃用之后,使用 :after in :
|
|
56
56
|
msgid "A paused task represents a process that has not finished properly. Any task in paused state can lead to potential inconsistency and needs to be resolved."
|
57
57
|
msgstr "暂停的任务代表未正确完成的进程。任何处于暂停状态的任务都可能导致潜在的不一致,需要被解决。"
|
58
58
|
|
59
|
+
msgid "A special label for tracking a recurring job. There can be only one active job with a given purpose at a time."
|
60
|
+
msgstr ""
|
61
|
+
|
59
62
|
msgid "Action"
|
60
63
|
msgstr "行动"
|
61
64
|
|
@@ -68,6 +71,9 @@ msgstr "活性"
|
|
68
71
|
msgid "Active Filters:"
|
69
72
|
msgstr "活跃的过滤器:"
|
70
73
|
|
74
|
+
msgid "Active or disabled recurring logic with purpose %s already exists"
|
75
|
+
msgstr ""
|
76
|
+
|
71
77
|
msgid "All %s tasks are selected. "
|
72
78
|
msgstr "已选择所有%s任务。 "
|
73
79
|
|
@@ -276,6 +282,9 @@ msgstr "Foreman 任务"
|
|
276
282
|
msgid "Fri"
|
277
283
|
msgstr "周五"
|
278
284
|
|
285
|
+
msgid "I understand that this may cause harm and have working database backups of all backend services."
|
286
|
+
msgstr ""
|
287
|
+
|
279
288
|
msgid "ID"
|
280
289
|
msgstr "ID"
|
281
290
|
|
@@ -427,9 +436,6 @@ msgstr "轮询间隔乘数"
|
|
427
436
|
msgid "Polling multiplier which is used to multiply the default polling intervals. This can be used to prevent polling too frequently for long running tasks."
|
428
437
|
msgstr "轮询乘数,用于乘以默认轮询间隔。这可用于防止对长时间运行的任务进行过于频繁的轮询。"
|
429
438
|
|
430
|
-
msgid "Preupgrade job"
|
431
|
-
msgstr ""
|
432
|
-
|
433
439
|
msgid "Proxy action retry count"
|
434
440
|
msgstr ""
|
435
441
|
|
@@ -442,6 +448,9 @@ msgstr "代理任务在智能代理中丢失"
|
|
442
448
|
msgid "Proxy tasks batch size"
|
443
449
|
msgstr ""
|
444
450
|
|
451
|
+
msgid "Purpose"
|
452
|
+
msgstr ""
|
453
|
+
|
445
454
|
msgid "Raw"
|
446
455
|
msgstr "Raw"
|
447
456
|
|
@@ -487,6 +496,9 @@ msgstr "所需的锁定已由其他正在运行的任务获取。"
|
|
487
496
|
msgid "Resource search_params requires resource_type and resource_id to be specified"
|
488
497
|
msgstr "資源 search_params 需要指定 resource_type 與 resource_id"
|
489
498
|
|
499
|
+
msgid "Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck."
|
500
|
+
msgstr ""
|
501
|
+
|
490
502
|
msgid "Result"
|
491
503
|
msgstr "结果"
|
492
504
|
|
@@ -663,6 +675,12 @@ msgstr[1] ""
|
|
663
675
|
msgid "This action will delete all cancelled recurring logics. Please note that this action can't be reversed."
|
664
676
|
msgstr "此操作将删除所有取消的重复逻辑。请注意,此操作无法撤消。"
|
665
677
|
|
678
|
+
msgid "This will %(action)s %(number)s task(s), putting them in the %(state)s state. Are you sure?"
|
679
|
+
msgstr ""
|
680
|
+
|
681
|
+
msgid "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
|
682
|
+
msgstr ""
|
683
|
+
|
666
684
|
msgid "Thu"
|
667
685
|
msgstr "周四"
|
668
686
|
|
@@ -717,6 +735,9 @@ msgstr "专注于最后"
|
|
717
735
|
msgid "Yes"
|
718
736
|
msgstr "是"
|
719
737
|
|
738
|
+
msgid "You can find resource locks on this page. Exclusive lock marked with locked icon means that no other task can use locked resource while this task is running. Non-exclusive lock marked with unlocked icon means other tasks can access the resource freely, it is only used to indicate the relation of this task with the resource"
|
739
|
+
msgstr ""
|
740
|
+
|
720
741
|
msgid "You do not have permission"
|
721
742
|
msgstr ""
|
722
743
|
|
@@ -758,6 +779,9 @@ msgstr "是分鐘(範圍:0-59)"
|
|
758
779
|
msgid "is month (range: 1-12)"
|
759
780
|
msgstr "是月份(範圍:1-12)"
|
760
781
|
|
782
|
+
msgid "is not a valid format"
|
783
|
+
msgstr ""
|
784
|
+
|
761
785
|
msgid "last"
|
762
786
|
msgstr "最近"
|
763
787
|
|
@@ -192,14 +192,13 @@ module ForemanTasks
|
|
192
192
|
_(task.state).must_equal 'running'
|
193
193
|
_(task.result).must_equal 'pending'
|
194
194
|
|
195
|
-
callback = Support::DummyProxyAction.proxy.log[:trigger_task].first[1][:action_input][:callback]
|
195
|
+
callback = Support::DummyProxyAction.proxy.log[:trigger_task].first[1].first[1][:action_input][:callback]
|
196
196
|
post :callback, params: { 'callback' => callback, 'data' => { 'result' => 'success' } }
|
197
197
|
triggered.finished.wait(5)
|
198
198
|
|
199
199
|
task.reload
|
200
200
|
_(task.state).must_equal 'stopped'
|
201
201
|
_(task.result).must_equal 'success'
|
202
|
-
_(task.main_action.output['proxy_task_id']).must_equal Support::DummyProxyAction.proxy.uuid
|
203
202
|
_(task.main_action.output['proxy_output']).must_equal('result' => 'success')
|
204
203
|
end
|
205
204
|
end
|
@@ -24,7 +24,7 @@ FactoryBot.define do
|
|
24
24
|
ForemanTasks::Task.where(:external_id => execution_plan.id).delete_all
|
25
25
|
task.update!(:external_id => execution_plan.id)
|
26
26
|
if evaluator.sync_with_dynflow
|
27
|
-
task.update_from_dynflow(execution_plan
|
27
|
+
task.update_from_dynflow(execution_plan)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -15,7 +15,7 @@ module Actions
|
|
15
15
|
middleware.use KeepCurrentTaxonomies
|
16
16
|
execution_plan_hooks.use :null_hook, :on => :planning
|
17
17
|
|
18
|
-
def null_hook; end
|
18
|
+
def null_hook(plan); end
|
19
19
|
end
|
20
20
|
|
21
21
|
before do
|
@@ -78,6 +78,14 @@ module Actions
|
|
78
78
|
Organization.stubs(:current=)
|
79
79
|
Location.stubs(:current=)
|
80
80
|
|
81
|
+
org_finder = mock('organization finder')
|
82
|
+
org_finder.stubs(:find).with(@org.id).returns(@org)
|
83
|
+
Organization.stubs(:unscoped).returns(org_finder)
|
84
|
+
|
85
|
+
loc_finder = mock('location finder')
|
86
|
+
loc_finder.stubs(:find).with(@loc.id).returns(@loc)
|
87
|
+
Location.stubs(:unscoped).returns(loc_finder)
|
88
|
+
|
81
89
|
triggered = ForemanTasks.trigger(TestHookAction)
|
82
90
|
task = ForemanTasks::Task.where(:external_id => triggered.id).first
|
83
91
|
wait_for { task.reload.state == 'stopped' }
|
@@ -40,7 +40,7 @@ module Support
|
|
40
40
|
def launch_tasks(operation, args = {})
|
41
41
|
@log[:trigger_task] << [operation, args]
|
42
42
|
@task_triggered.fulfill(true)
|
43
|
-
{ 'task_id' => @uuid, 'result' => 'success' }
|
43
|
+
{ 'task_id' => @uuid, 'result' => 'success', 'parent' => { 'task_id' => @uuid } }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'foreman_tasks_test_helper'
|
2
|
+
require 'ostruct'
|
2
3
|
|
3
4
|
module ForemanTasks
|
4
5
|
class ProxyActionTest < ActiveSupport::TestCase
|
@@ -22,24 +23,29 @@ module ForemanTasks
|
|
22
23
|
'foo' => 'bar',
|
23
24
|
'secrets' => secrets,
|
24
25
|
'use_batch_triggering' => batch_triggering)
|
26
|
+
RemoteTask.any_instance.stubs(:action).returns(@action)
|
27
|
+
RemoteTask.any_instance.stubs(:task).returns(OpenStruct.new(:id => Support::DummyProxyAction.proxy.uuid))
|
28
|
+
@run_step_id = @action.run_step_id
|
29
|
+
|
25
30
|
@action = run_action(@action)
|
26
31
|
end
|
27
32
|
|
28
33
|
describe 'first run' do
|
29
34
|
it 'triggers the corresponding action on the proxy' do
|
30
35
|
proxy_call = Support::DummyProxyAction.proxy.log[:trigger_task].first
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
action_input =
|
37
|
+
{ :action_class => 'Proxy::DummyAction',
|
38
|
+
:action_input =>
|
39
|
+
{ 'foo' => 'bar',
|
40
|
+
'secrets' => secrets,
|
41
|
+
'connection_options' =>
|
42
|
+
{ 'retry_interval' => 15, 'retry_count' => 4,
|
43
|
+
'proxy_batch_triggering' => batch_triggering },
|
44
|
+
'use_batch_triggering' => batch_triggering,
|
45
|
+
'proxy_url' => 'proxy.example.com',
|
46
|
+
'proxy_action_name' => 'Proxy::DummyAction',
|
47
|
+
'callback' => { 'task_id' => Support::DummyProxyAction.proxy.uuid, 'step_id' => @run_step_id } } }
|
48
|
+
expected_call = ['support', { @action.execution_plan_id => action_input }]
|
43
49
|
_(proxy_call).must_equal(expected_call)
|
44
50
|
end
|
45
51
|
|
@@ -73,7 +79,7 @@ module ForemanTasks
|
|
73
79
|
describe 'cancel' do
|
74
80
|
it 'sends the cancel event to the proxy when the cancel event is sent for the first time' do
|
75
81
|
action = run_action(@action, ::Dynflow::Action::Cancellable::Cancel)
|
76
|
-
_(Support::DummyProxyAction.proxy.log[:cancel_task].first).must_equal [
|
82
|
+
_(Support::DummyProxyAction.proxy.log[:cancel_task].first).must_equal [action.execution_plan_id]
|
77
83
|
_(action.state).must_equal :suspended
|
78
84
|
end
|
79
85
|
|
@@ -46,7 +46,6 @@ module ForemanTasks
|
|
46
46
|
|
47
47
|
it 'fetches batch_size of tasks and triggers them' do
|
48
48
|
remote_tasks.expects(:first).with(batch_size).returns(remote_tasks)
|
49
|
-
remote_tasks.expects(:size).returns(batch_size)
|
50
49
|
triggered.expects(:remote_tasks).returns(remote_tasks)
|
51
50
|
ForemanTasks::RemoteTask.expects(:batch_trigger).with(proxy_operation_name, grouped_remote_batch)
|
52
51
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
2
|
-
import { addToast } from 'foremanReact/
|
2
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
3
3
|
import { TASKS_DASHBOARD_JS_QUERY_MODES } from '../TasksDashboard/TasksDashboardConstants';
|
4
4
|
import { timeToHoursNumber } from '../TasksDashboard/TasksDashboardHelper';
|
5
5
|
import {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { sprintf } from 'foremanReact/common/I18n';
|
2
2
|
import { API } from 'foremanReact/redux/API';
|
3
|
-
import { addToast } from 'foremanReact/
|
3
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
4
4
|
import {
|
5
5
|
TASKS_RESUME_REQUEST,
|
6
6
|
TASKS_RESUME_SUCCESS,
|
@@ -3,6 +3,18 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import { Alert, Card, Row, Col } from 'patternfly-react';
|
4
4
|
import { translate as __ } from 'foremanReact/common/I18n';
|
5
5
|
|
6
|
+
const ConditionalLink = ({ children, link }) =>
|
7
|
+
link ? <a href={link}>{children}</a> : children;
|
8
|
+
|
9
|
+
ConditionalLink.propTypes = {
|
10
|
+
children: PropTypes.node.isRequired,
|
11
|
+
link: PropTypes.string,
|
12
|
+
};
|
13
|
+
|
14
|
+
ConditionalLink.defaultProps = {
|
15
|
+
link: null,
|
16
|
+
};
|
17
|
+
|
6
18
|
const Locks = ({ locks }) => (
|
7
19
|
<div>
|
8
20
|
<Alert type="info">
|
@@ -14,20 +26,22 @@ const Locks = ({ locks }) => (
|
|
14
26
|
<Row>
|
15
27
|
{locks.map((lock, key) => (
|
16
28
|
<Col xs={6} sm={4} md={4} key={key}>
|
17
|
-
<
|
18
|
-
<Card
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
<ConditionalLink link={lock.link}>
|
30
|
+
<Card className="card-pf-aggregate-status" accented>
|
31
|
+
<Card.Title>
|
32
|
+
<span
|
33
|
+
className={`fa ${
|
34
|
+
lock.exclusive ? 'fa-lock' : 'fa-unlock-alt'
|
35
|
+
}`}
|
36
|
+
/>
|
37
|
+
{lock.resource_type}
|
38
|
+
</Card.Title>
|
39
|
+
<Card.Body>
|
40
|
+
{`id:${lock.resource_id}`}
|
41
|
+
<br />
|
42
|
+
</Card.Body>
|
43
|
+
</Card>
|
44
|
+
</ConditionalLink>
|
31
45
|
</Col>
|
32
46
|
))}
|
33
47
|
</Row>
|
@@ -25,29 +25,33 @@ exports[`Locks rendering render with Props 1`] = `
|
|
25
25
|
sm={4}
|
26
26
|
xs={6}
|
27
27
|
>
|
28
|
-
<
|
29
|
-
|
30
|
-
aggregated={false}
|
31
|
-
aggregatedMini={false}
|
32
|
-
cardRef={null}
|
33
|
-
className="card-pf-aggregate-status"
|
34
|
-
matchHeight={false}
|
28
|
+
<ConditionalLink
|
29
|
+
link={null}
|
35
30
|
>
|
36
|
-
<
|
37
|
-
|
31
|
+
<Card
|
32
|
+
accented={true}
|
33
|
+
aggregated={false}
|
34
|
+
aggregatedMini={false}
|
35
|
+
cardRef={null}
|
36
|
+
className="card-pf-aggregate-status"
|
37
|
+
matchHeight={false}
|
38
38
|
>
|
39
|
-
<
|
40
|
-
className="
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
<CardTitle
|
40
|
+
className=""
|
41
|
+
>
|
42
|
+
<span
|
43
|
+
className="fa fa-unlock-alt"
|
44
|
+
/>
|
45
|
+
User
|
46
|
+
</CardTitle>
|
47
|
+
<CardBody
|
48
|
+
className=""
|
49
|
+
>
|
50
|
+
id:4
|
51
|
+
<br />
|
52
|
+
</CardBody>
|
53
|
+
</Card>
|
54
|
+
</ConditionalLink>
|
51
55
|
</Col>
|
52
56
|
<Col
|
53
57
|
bsClass="col"
|
@@ -57,29 +61,33 @@ exports[`Locks rendering render with Props 1`] = `
|
|
57
61
|
sm={4}
|
58
62
|
xs={6}
|
59
63
|
>
|
60
|
-
<
|
61
|
-
|
62
|
-
aggregated={false}
|
63
|
-
aggregatedMini={false}
|
64
|
-
cardRef={null}
|
65
|
-
className="card-pf-aggregate-status"
|
66
|
-
matchHeight={false}
|
64
|
+
<ConditionalLink
|
65
|
+
link={null}
|
67
66
|
>
|
68
|
-
<
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
</CardTitle>
|
76
|
-
<CardBody
|
77
|
-
className=""
|
67
|
+
<Card
|
68
|
+
accented={true}
|
69
|
+
aggregated={false}
|
70
|
+
aggregatedMini={false}
|
71
|
+
cardRef={null}
|
72
|
+
className="card-pf-aggregate-status"
|
73
|
+
matchHeight={false}
|
78
74
|
>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
<CardTitle
|
76
|
+
className=""
|
77
|
+
>
|
78
|
+
<span
|
79
|
+
className="fa fa-unlock-alt"
|
80
|
+
/>
|
81
|
+
User
|
82
|
+
</CardTitle>
|
83
|
+
<CardBody
|
84
|
+
className=""
|
85
|
+
>
|
86
|
+
id:2
|
87
|
+
<br />
|
88
|
+
</CardBody>
|
89
|
+
</Card>
|
90
|
+
</ConditionalLink>
|
83
91
|
</Col>
|
84
92
|
</Row>
|
85
93
|
</CardGrid>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { API } from 'foremanReact/redux/API';
|
2
|
-
import { addToast } from 'foremanReact/
|
2
|
+
import { addToast } from 'foremanReact/components/ToastsList';
|
3
3
|
import { translate as __, sprintf } from 'foremanReact/common/I18n';
|
4
4
|
import {
|
5
5
|
BULK_CANCEL_PATH,
|