foreman-tasks 4.0.0 → 5.0.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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby_tests.yml +4 -3
- data/app/controllers/concerns/foreman_tasks/find_tasks_common.rb +14 -0
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +4 -6
- data/app/controllers/foreman_tasks/tasks_controller.rb +3 -11
- data/app/graphql/types/recurring_logic.rb +18 -0
- data/app/graphql/types/task.rb +25 -0
- data/app/graphql/types/triggering.rb +16 -0
- data/app/lib/actions/helpers/with_continuous_output.rb +1 -1
- data/app/lib/actions/middleware/load_setting_values.rb +35 -0
- data/app/lib/actions/observable_action.rb +1 -1
- data/app/lib/actions/proxy_action.rb +2 -4
- data/app/models/foreman_tasks/recurring_logic.rb +2 -0
- data/app/models/foreman_tasks/task.rb +30 -2
- data/app/models/foreman_tasks/triggering.rb +2 -0
- data/db/migrate/20180927120509_add_user_id.foreman_tasks.rb +4 -2
- data/foreman-tasks.gemspec +0 -1
- data/lib/foreman_tasks.rb +2 -5
- data/lib/foreman_tasks/continuous_output.rb +50 -0
- data/lib/foreman_tasks/engine.rb +7 -15
- data/lib/foreman_tasks/version.rb +1 -1
- data/locale/action_names.rb +3 -2
- data/locale/en/foreman_tasks.po +60 -27
- data/locale/foreman_tasks.pot +180 -132
- data/locale/fr/foreman_tasks.po +61 -28
- data/locale/ja/foreman_tasks.po +61 -28
- data/locale/zh_CN/foreman_tasks.po +61 -28
- data/test/controllers/api/tasks_controller_test.rb +16 -1
- data/test/controllers/tasks_controller_test.rb +2 -2
- data/test/factories/task_factory.rb +31 -4
- data/test/graphql/queries/recurring_logic_test.rb +28 -0
- data/test/graphql/queries/recurring_logics_query_test.rb +30 -0
- data/test/graphql/queries/task_query_test.rb +33 -0
- data/test/graphql/queries/tasks_query_test.rb +31 -0
- data/test/unit/actions/proxy_action_test.rb +4 -1
- data/test/unit/task_test.rb +54 -23
- data/test/unit/triggering_test.rb +2 -2
- metadata +16 -26
- data/test/core/unit/dispatcher_test.rb +0 -43
- data/test/core/unit/runner_test.rb +0 -129
- data/test/core/unit/task_launcher_test.rb +0 -56
- data/test/foreman_tasks_core_test_helper.rb +0 -4
- data/test/unit/otp_manager_test.rb +0 -77
@@ -74,6 +74,9 @@ msgstr "已选择所有%s任务。 "
|
|
74
74
|
msgid "All proxies with the required feature are unavailable at the moment"
|
75
75
|
msgstr "具备所需功能的所有代理暂时都不可用"
|
76
76
|
|
77
|
+
msgid "Allow proxy batch tasks"
|
78
|
+
msgstr ""
|
79
|
+
|
77
80
|
msgid "Allow triggering tasks on the smart proxy in batches"
|
78
81
|
msgstr "允许批量触发智能代理上的任务"
|
79
82
|
|
@@ -99,15 +102,15 @@ msgstr "取消"
|
|
99
102
|
msgid "Cancel Selected"
|
100
103
|
msgstr "取消选择"
|
101
104
|
|
102
|
-
msgid "Cancel all cancellable tasks"
|
103
|
-
msgstr "取消所有可取消的任务"
|
104
|
-
|
105
105
|
msgid "Cancel enforced: the task might be still running on the proxy"
|
106
106
|
msgstr "強制取消:任務可能還在代理伺服器上執行"
|
107
107
|
|
108
108
|
msgid "Cancel recurring logic"
|
109
109
|
msgstr "取消週期邏輯"
|
110
110
|
|
111
|
+
msgid "Cancel selected cancellable tasks"
|
112
|
+
msgstr ""
|
113
|
+
|
111
114
|
msgid "Cancel selected tasks"
|
112
115
|
msgstr "取消选择的任务"
|
113
116
|
|
@@ -156,6 +159,9 @@ msgstr "与任务冲突 :"
|
|
156
159
|
msgid "Could not cancel step."
|
157
160
|
msgstr ""
|
158
161
|
|
162
|
+
msgid "Could not receive data: ${APIerror && APIerror.message}"
|
163
|
+
msgstr ""
|
164
|
+
|
159
165
|
msgid "Could not receive data: ${error && error.message}"
|
160
166
|
msgstr "无法接收数据: ${error && error.message}"
|
161
167
|
|
@@ -207,6 +213,9 @@ msgstr "清空批次動作"
|
|
207
213
|
msgid "Enable"
|
208
214
|
msgstr "启用"
|
209
215
|
|
216
|
+
msgid "Enable dynflow console"
|
217
|
+
msgstr ""
|
218
|
+
|
210
219
|
msgid "Enable the dynflow console (/foreman_tasks/dynflow) for debugging"
|
211
220
|
msgstr "啟用 dynflow 主控台(/foreman_tasks/dynflow)作為偵錯使用"
|
212
221
|
|
@@ -246,9 +255,6 @@ msgstr "无法检查在 %{url} 代理中的任务: %{exception}"
|
|
246
255
|
msgid "Failed to initialize"
|
247
256
|
msgstr "無法初始化"
|
248
257
|
|
249
|
-
msgid "Field to sort the results on"
|
250
|
-
msgstr "用來排序結果的欄位"
|
251
|
-
|
252
258
|
msgid "Finished"
|
253
259
|
msgstr "完成"
|
254
260
|
|
@@ -270,12 +276,6 @@ msgstr "Foreman 任务"
|
|
270
276
|
msgid "Fri"
|
271
277
|
msgstr "周五"
|
272
278
|
|
273
|
-
msgid "Hash version of 'order' param"
|
274
|
-
msgstr "「order」參數的雜湊版本"
|
275
|
-
|
276
|
-
msgid "How to order the sorted results (e.g. ASC for ascending)"
|
277
|
-
msgstr "如何排序結果的順序(比方說 ASC 從下到上)"
|
278
|
-
|
279
279
|
msgid "ID"
|
280
280
|
msgstr "ID"
|
281
281
|
|
@@ -381,9 +381,6 @@ msgstr "并非所有选定的任务都可以恢复"
|
|
381
381
|
msgid "Number of attempts to start a task on the smart proxy before failing"
|
382
382
|
msgstr "在智慧代理上啟動任務的嘗試次數"
|
383
383
|
|
384
|
-
msgid "Number of results per page to return"
|
385
|
-
msgstr "每頁要傳回的結果數量"
|
386
|
-
|
387
384
|
msgid "Number of seconds to wait for synchronous task to finish."
|
388
385
|
msgstr "等待同步任务完成的秒数。"
|
389
386
|
|
@@ -397,15 +394,18 @@ msgstr "上"
|
|
397
394
|
msgid "Operation"
|
398
395
|
msgstr "操作"
|
399
396
|
|
397
|
+
msgid "Other includes all stopped tasks that are cancelled or pending"
|
398
|
+
msgstr ""
|
399
|
+
|
400
|
+
msgid "Other:"
|
401
|
+
msgstr ""
|
402
|
+
|
400
403
|
msgid "Output"
|
401
404
|
msgstr "输出"
|
402
405
|
|
403
406
|
msgid "Output:"
|
404
407
|
msgstr "输出:"
|
405
408
|
|
406
|
-
msgid "Page number, starting at 1"
|
407
|
-
msgstr "頁數,從 1 開始"
|
408
|
-
|
409
409
|
msgid "Parent task"
|
410
410
|
msgstr "父任務"
|
411
411
|
|
@@ -427,9 +427,21 @@ msgstr "轮询间隔乘数"
|
|
427
427
|
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
428
|
msgstr "轮询乘数,用于乘以默认轮询间隔。这可用于防止对长时间运行的任务进行过于频繁的轮询。"
|
429
429
|
|
430
|
+
msgid "Preupgrade job"
|
431
|
+
msgstr ""
|
432
|
+
|
433
|
+
msgid "Proxy action retry count"
|
434
|
+
msgstr ""
|
435
|
+
|
436
|
+
msgid "Proxy action retry interval"
|
437
|
+
msgstr ""
|
438
|
+
|
430
439
|
msgid "Proxy task gone missing from the smart proxy"
|
431
440
|
msgstr "代理任务在智能代理中丢失"
|
432
441
|
|
442
|
+
msgid "Proxy tasks batch size"
|
443
|
+
msgstr ""
|
444
|
+
|
433
445
|
msgid "Raw"
|
434
446
|
msgstr "Raw"
|
435
447
|
|
@@ -448,6 +460,12 @@ msgstr "週期邏輯"
|
|
448
460
|
msgid "Recurring logics"
|
449
461
|
msgstr "週期邏輯"
|
450
462
|
|
463
|
+
msgid "Refresh Data"
|
464
|
+
msgstr ""
|
465
|
+
|
466
|
+
msgid "Remote action:"
|
467
|
+
msgstr ""
|
468
|
+
|
451
469
|
msgid "Repeat N times"
|
452
470
|
msgstr "重複 N 次"
|
453
471
|
|
@@ -457,15 +475,15 @@ msgstr "重複直到"
|
|
457
475
|
msgid "Repeats"
|
458
476
|
msgstr "重複"
|
459
477
|
|
478
|
+
msgid "Require auth for dynflow console"
|
479
|
+
msgstr ""
|
480
|
+
|
460
481
|
msgid "Require user to be authenticated as user with admin rights when accessing dynflow console"
|
461
482
|
msgstr "存取 dynflow 主控台時,需要使用者授權成為擁有 admin 權限的使用者"
|
462
483
|
|
463
484
|
msgid "Required lock is already taken by other running tasks."
|
464
485
|
msgstr "所需的锁定已由其他正在运行的任务获取。"
|
465
486
|
|
466
|
-
msgid "Required lock: %s"
|
467
|
-
msgstr "所需的锁定 : %s"
|
468
|
-
|
469
487
|
msgid "Resource search_params requires resource_type and resource_id to be specified"
|
470
488
|
msgstr "資源 search_params 需要指定 resource_type 與 resource_id"
|
471
489
|
|
@@ -514,9 +532,6 @@ msgstr "调度的"
|
|
514
532
|
msgid "Search query"
|
515
533
|
msgstr "搜索查询"
|
516
534
|
|
517
|
-
msgid "Search string"
|
518
|
-
msgstr "搜尋字串"
|
519
|
-
|
520
535
|
msgid "See %{link} for more details on how to resolve the issue"
|
521
536
|
msgstr "有关如何解决此问题的更多详细信息,请参见%{link}"
|
522
537
|
|
@@ -535,12 +550,12 @@ msgstr "從外部執行者(例如 smart_proxy_dynflow)發送資料到任務"
|
|
535
550
|
msgid "Set up recurring execution"
|
536
551
|
msgstr "設定週期執行"
|
537
552
|
|
553
|
+
msgid "Setting is off"
|
554
|
+
msgstr ""
|
555
|
+
|
538
556
|
msgid "Show recurring logic details"
|
539
557
|
msgstr "顯示週期邏輯的詳情"
|
540
558
|
|
541
|
-
msgid "Sort field and order, e.g. 'name DESC'"
|
542
|
-
msgstr "排序欄位與次序,例如「name DESC」"
|
543
|
-
|
544
559
|
msgid "Start at"
|
545
560
|
msgstr "開始於"
|
546
561
|
|
@@ -559,7 +574,7 @@ msgstr "州"
|
|
559
574
|
msgid "Step Canceled"
|
560
575
|
msgstr ""
|
561
576
|
|
562
|
-
msgid "Stop
|
577
|
+
msgid "Stop selected stoppable tasks"
|
563
578
|
msgstr ""
|
564
579
|
|
565
580
|
msgid "Stop specific tasks by ID"
|
@@ -580,6 +595,9 @@ msgstr "%s 的子任务"
|
|
580
595
|
msgid "Sun"
|
581
596
|
msgstr "周日"
|
582
597
|
|
598
|
+
msgid "Sync task timeout"
|
599
|
+
msgstr ""
|
600
|
+
|
583
601
|
msgid "Task"
|
584
602
|
msgstr "任務"
|
585
603
|
|
@@ -610,12 +628,21 @@ msgstr "任务已取消"
|
|
610
628
|
msgid "Tasks"
|
611
629
|
msgstr "任务"
|
612
630
|
|
631
|
+
msgid "Tasks troubleshooting URL"
|
632
|
+
msgstr ""
|
633
|
+
|
613
634
|
msgid "The ID of the step inside the execution plan to send the event to"
|
614
635
|
msgstr "執行計畫中要發送事件的步驟 ID"
|
615
636
|
|
616
637
|
msgid "The recommended approach is to investigate the error messages below and in 'errors' tab, address the primary cause of the issue and resume the task."
|
617
638
|
msgstr "推荐的方法是调查下面和“错误”选项卡中的错误消息,解决造成问题的主要原因,然后继续执行任务。"
|
618
639
|
|
640
|
+
msgid "The recurring logic was disabled."
|
641
|
+
msgstr ""
|
642
|
+
|
643
|
+
msgid "The recurring logic was enabled."
|
644
|
+
msgstr ""
|
645
|
+
|
619
646
|
msgid "The smart proxy task %s failed."
|
620
647
|
msgstr "智慧型代理任務 %s 失敗。"
|
621
648
|
|
@@ -690,6 +717,9 @@ msgstr "专注于最后"
|
|
690
717
|
msgid "Yes"
|
691
718
|
msgstr "是"
|
692
719
|
|
720
|
+
msgid "You do not have permission"
|
721
|
+
msgstr ""
|
722
|
+
|
693
723
|
msgid "activation key"
|
694
724
|
msgstr "啟動金鑰"
|
695
725
|
|
@@ -743,6 +773,9 @@ msgstr "较老"
|
|
743
773
|
msgid "organization"
|
744
774
|
msgstr "組織"
|
745
775
|
|
776
|
+
msgid "other"
|
777
|
+
msgstr ""
|
778
|
+
|
746
779
|
msgid "paused"
|
747
780
|
msgstr "暂停"
|
748
781
|
|
@@ -29,7 +29,7 @@ module ForemanTasks
|
|
29
29
|
|
30
30
|
it 'renders task ids when searching by resource id' do
|
31
31
|
task = FactoryBot.create(:dynflow_task, :product_create_task)
|
32
|
-
ForemanTasks::
|
32
|
+
ForemanTasks::Link.create!(resource_type: "Katello::Product", resource_id: 1, task_id: task.id)
|
33
33
|
get :index, params: { :search => "label = Actions::Katello::Product::Create and resource_id = 1" }
|
34
34
|
assert_response :success
|
35
35
|
data = JSON.parse(response.body)
|
@@ -43,6 +43,21 @@ module ForemanTasks
|
|
43
43
|
_(data.dig('sort', 'by')).must_equal 'duration'
|
44
44
|
_(data['results'].count).must_equal 5
|
45
45
|
end
|
46
|
+
|
47
|
+
context 'with current taxonomies' do
|
48
|
+
it 'includes untaxed tasks and taxed by current taxonomy' do
|
49
|
+
org1 = FactoryBot.create(:organization)
|
50
|
+
org2 = FactoryBot.create(:organization)
|
51
|
+
org1_task = FactoryBot.create(:task_with_links, resource_id: org1.id, resource_type: 'Organization')
|
52
|
+
org2_task = FactoryBot.create(:task_with_links, resource_id: org2.id, resource_type: 'Organization')
|
53
|
+
get :index, params: { organization_id: org1.id }
|
54
|
+
assert_response :success
|
55
|
+
results = JSON.parse(response.body)['results']
|
56
|
+
_(results.count).must_equal 6
|
57
|
+
_(results.map { |r| r['id'] }).must_include org1_task.id
|
58
|
+
_(results.map { |r| r['id'] }).wont_include org2_task.id
|
59
|
+
end
|
60
|
+
end
|
46
61
|
end
|
47
62
|
|
48
63
|
describe 'POST /api/tasks/bulk_search' do
|
@@ -44,8 +44,8 @@ module ForemanTasks
|
|
44
44
|
@locations = [0, 0].map { FactoryBot.create(:location) }
|
45
45
|
@tasks = [0, 0].map { FactoryBot.create(:some_task) }
|
46
46
|
@tasks.zip(@organizations, @locations).each do |task, org, loc|
|
47
|
-
|
48
|
-
|
47
|
+
Link.link!(org, task)
|
48
|
+
Link.link!(loc, task)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -42,11 +42,34 @@ FactoryBot.define do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
factory :task_with_links do
|
46
|
+
# posts_count is declared as a transient attribute and available in
|
47
|
+
# attributes on the factory, as well as the callback via the evaluator
|
48
|
+
transient do
|
49
|
+
locks_count { 1 }
|
50
|
+
resource_id { 1 }
|
51
|
+
resource_type { 'type1' }
|
52
|
+
end
|
53
|
+
|
54
|
+
# the after(:create) yields two values; the user instance itself and the
|
55
|
+
# evaluator, which stores all values from the factory, including transient
|
56
|
+
# attributes; `create_list`'s second argument is the number of records
|
57
|
+
# to create and we make sure the user is associated properly to the post
|
58
|
+
after(:create) do |task, evaluator|
|
59
|
+
create_list(
|
60
|
+
:link,
|
61
|
+
1,
|
62
|
+
task: task,
|
63
|
+
resource_type: evaluator.resource_type,
|
64
|
+
resource_id: evaluator.resource_id
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
45
69
|
factory :task_with_locks do
|
46
70
|
# posts_count is declared as a transient attribute and available in
|
47
71
|
# attributes on the factory, as well as the callback via the evaluator
|
48
72
|
transient do
|
49
|
-
locks_count { 3 }
|
50
73
|
resource_id { 1 }
|
51
74
|
resource_type { 'type1' }
|
52
75
|
end
|
@@ -58,7 +81,7 @@ FactoryBot.define do
|
|
58
81
|
after(:create) do |task, evaluator|
|
59
82
|
create_list(
|
60
83
|
:lock,
|
61
|
-
|
84
|
+
1,
|
62
85
|
task: task,
|
63
86
|
resource_type: evaluator.resource_type,
|
64
87
|
resource_id: evaluator.resource_id
|
@@ -68,11 +91,15 @@ FactoryBot.define do
|
|
68
91
|
end
|
69
92
|
end
|
70
93
|
|
94
|
+
factory :link, :class => ForemanTasks::Link do
|
95
|
+
resource_type { 'Katello::Repository' }
|
96
|
+
resource_id { 1 }
|
97
|
+
association :task, factory: :task_with_links
|
98
|
+
end
|
99
|
+
|
71
100
|
factory :lock, :class => ForemanTasks::Lock do
|
72
|
-
name { 'read' }
|
73
101
|
resource_type { 'Katello::Repository' }
|
74
102
|
resource_id { 1 }
|
75
|
-
exclusive { true }
|
76
103
|
association :task, factory: :task_with_locks
|
77
104
|
end
|
78
105
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'foreman_tasks_test_helper'
|
2
|
+
|
3
|
+
module Queries
|
4
|
+
class RecurringLogicTest < GraphQLQueryTestCase
|
5
|
+
let(:query) do
|
6
|
+
<<-GRAPHQL
|
7
|
+
query($id: String!) {
|
8
|
+
recurringLogic(id: $id) {
|
9
|
+
id
|
10
|
+
cronLine
|
11
|
+
}
|
12
|
+
}
|
13
|
+
GRAPHQL
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:cron_line) { '5 4 3 2 1' }
|
17
|
+
let(:recurring_logic) { FactoryBot.create(:recurring_logic, :cron_line => cron_line) }
|
18
|
+
let(:global_id) { Foreman::GlobalId.for(recurring_logic) }
|
19
|
+
let(:variables) { { id: global_id } }
|
20
|
+
let(:data) { result['data']['recurringLogic'] }
|
21
|
+
|
22
|
+
test "should fetch recurring logic" do
|
23
|
+
assert_empty result['errors']
|
24
|
+
assert_equal global_id, data['id']
|
25
|
+
assert_equal cron_line, data['cronLine']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'foreman_tasks_test_helper'
|
2
|
+
|
3
|
+
module Queries
|
4
|
+
class RecurringLogicsTest < GraphQLQueryTestCase
|
5
|
+
let(:query) do
|
6
|
+
<<-GRAPHQL
|
7
|
+
query {
|
8
|
+
recurringLogics {
|
9
|
+
nodes {
|
10
|
+
id
|
11
|
+
cronLine
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
GRAPHQL
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:data) { result['data']['recurringLogics'] }
|
19
|
+
|
20
|
+
setup do
|
21
|
+
FactoryBot.create_list(:recurring_logic, 2)
|
22
|
+
end
|
23
|
+
|
24
|
+
test "should fetch recurring logics" do
|
25
|
+
assert_empty result['errors']
|
26
|
+
expected_count = ::ForemanTasks::RecurringLogic.count
|
27
|
+
assert_not_equal 0, expected_count
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'foreman_tasks_test_helper'
|
2
|
+
|
3
|
+
module Queries
|
4
|
+
class TaskQueryTest < GraphQLQueryTestCase
|
5
|
+
let(:query) do
|
6
|
+
<<-GRAPHQL
|
7
|
+
query (
|
8
|
+
$id: String!
|
9
|
+
) {
|
10
|
+
task(id: $id) {
|
11
|
+
id
|
12
|
+
action
|
13
|
+
result
|
14
|
+
}
|
15
|
+
}
|
16
|
+
GRAPHQL
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:res) { 'inconclusive' }
|
20
|
+
let(:task) { FactoryBot.create(:some_task, :result => res) }
|
21
|
+
|
22
|
+
let(:global_id) { Foreman::GlobalId.for(task) }
|
23
|
+
let(:variables) { { id: global_id } }
|
24
|
+
let(:data) { result['data']['task'] }
|
25
|
+
|
26
|
+
test 'should fetch task data' do
|
27
|
+
assert_empty result['errors']
|
28
|
+
|
29
|
+
assert_equal global_id, data['id']
|
30
|
+
assert_equal task.result, data['result']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'foreman_tasks_test_helper'
|
2
|
+
|
3
|
+
module Queries
|
4
|
+
class TasksQueryTest < GraphQLQueryTestCase
|
5
|
+
let(:query) do
|
6
|
+
<<-GRAPHQL
|
7
|
+
query {
|
8
|
+
tasks {
|
9
|
+
nodes {
|
10
|
+
id
|
11
|
+
action
|
12
|
+
result
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
GRAPHQL
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:data) { result['data']['tasks'] }
|
20
|
+
|
21
|
+
setup do
|
22
|
+
FactoryBot.create_list(:some_task, 2)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "should fetch recurring logics" do
|
26
|
+
assert_empty result['errors']
|
27
|
+
expected_count = ::ForemanTasks::Task.count
|
28
|
+
assert_not_equal 0, expected_count
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|