foreman_remote_execution 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_remote_execution/template_input.js +0 -10
- data/app/assets/javascripts/foreman_remote_execution/template_invocation.js +1 -12
- data/app/assets/stylesheets/foreman_remote_execution/template_invocation.css.scss +1 -0
- data/app/controllers/api/v2/job_invocations_controller.rb +5 -1
- data/app/helpers/job_invocation_output_helper.rb +5 -4
- data/app/helpers/job_invocations_helper.rb +0 -29
- data/app/helpers/remote_execution_helper.rb +1 -24
- data/app/lib/foreman_remote_execution/renderer/scope/input.rb +28 -8
- data/app/models/concerns/foreman_remote_execution/template_extensions.rb +0 -12
- data/app/models/concerns/foreman_remote_execution/template_input_extensions.rb +9 -0
- data/app/models/concerns/foreman_remote_execution/template_overrides.rb +11 -0
- data/app/models/input_template_renderer.rb +16 -17
- data/app/models/job_invocation.rb +14 -4
- data/app/models/job_invocation_composer.rb +2 -6
- data/app/models/job_template.rb +23 -52
- data/app/models/template_invocation_input_value.rb +12 -1
- data/app/views/api/v2/smart_proxies/pubkey.json.rabl +1 -0
- data/app/views/job_invocations/_form.html.erb +1 -7
- data/app/views/job_templates/_custom_tabs.html.erb +0 -7
- data/app/views/template_invocations/_output_line_set.html.erb +2 -2
- data/app/views/templates/ssh/module_action.erb +67 -0
- data/app/views/templates/ssh/package_action.erb +39 -7
- data/app/views/templates/ssh/power_action.erb +2 -1
- data/app/views/templates/ssh/puppet_run_once.erb +1 -0
- data/app/views/templates/ssh/run_command.erb +1 -0
- data/app/views/templates/ssh/service_action.erb +9 -1
- data/config/routes.rb +0 -1
- data/lib/foreman_remote_execution/engine.rb +4 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +3 -72
- data/locale/en/foreman_remote_execution.po +3 -72
- data/locale/en_GB/foreman_remote_execution.po +3 -72
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +3 -72
- data/locale/foreman_remote_execution.pot +124 -225
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +3 -72
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +3 -72
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +3 -72
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +3 -72
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +3 -72
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +3 -72
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +3 -72
- data/test/factories/foreman_remote_execution_factories.rb +6 -5
- data/test/functional/api/v2/job_invocations_controller_test.rb +10 -0
- data/test/unit/input_template_renderer_test.rb +52 -21
- data/test/unit/job_invocation_composer_test.rb +2 -2
- data/test/unit/job_invocation_test.rb +36 -0
- metadata +6 -19
- data/app/controllers/api/v2/template_inputs_controller.rb +0 -92
- data/app/controllers/concerns/foreman/controller/parameters/template_input.rb +0 -17
- data/app/models/template_input.rb +0 -179
- data/app/views/api/v2/template_inputs/base.json.rabl +0 -3
- data/app/views/api/v2/template_inputs/create.json.rabl +0 -3
- data/app/views/api/v2/template_inputs/index.json.rabl +0 -3
- data/app/views/api/v2/template_inputs/main.json.rabl +0 -10
- data/app/views/api/v2/template_inputs/show.json.rabl +0 -3
- data/app/views/template_inputs/_form.html.erb +0 -25
- data/app/views/template_inputs/_invocation_form.html.erb +0 -7
- data/db/migrate/20150616080015_create_template_input.rb +0 -19
- data/db/migrate/20150827152730_add_options_to_template_input.rb +0 -5
- data/db/migrate/20160127134031_add_advanced_to_template_input.rb +0 -11
- data/test/functional/api/v2/template_inputs_controller_test.rb +0 -56
- data/test/unit/template_input_test.rb +0 -40
Binary file
|
@@ -40,9 +40,6 @@ msgstr "從外部範本納入的輸入名稱清單,以逗號隔開。"
|
|
40
40
|
msgid "A job '%{subject}' has finished successfully"
|
41
41
|
msgstr ""
|
42
42
|
|
43
|
-
msgid "A list of options the user can select from. If not provided, the user will be given a free-form field"
|
44
|
-
msgstr "使用者可以選擇的選項清單。如果沒有提供的話,使用者會被給予開放清單的欄位"
|
45
|
-
|
46
43
|
msgid "A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality."
|
47
44
|
msgstr "將遠端執行帶入 Foreman 的外掛程式,搭配遠端管理功能來完成配置管理。"
|
48
45
|
|
@@ -61,9 +58,6 @@ msgstr "動作"
|
|
61
58
|
msgid "Add Foreign Input Set"
|
62
59
|
msgstr "新增外部輸入集"
|
63
60
|
|
64
|
-
msgid "Add Input"
|
65
|
-
msgstr "新增輸入"
|
66
|
-
|
67
61
|
msgid "Amount of workers in the pool to handle the execution of the remote execution jobs. Restart of the dynflowd/foreman-tasks service is required."
|
68
62
|
msgstr ""
|
69
63
|
|
@@ -127,6 +121,9 @@ msgstr ""
|
|
127
121
|
msgid "Could not render the preview because no host matches the search query."
|
128
122
|
msgstr ""
|
129
123
|
|
124
|
+
msgid "Could not rerun job %{id} because its template could not be found"
|
125
|
+
msgstr ""
|
126
|
+
|
130
127
|
msgid "Could not use any proxy. Consider configuring %{global_proxy}, %{fallback_proxy} or %{no_proxy} in settings"
|
131
128
|
msgstr ""
|
132
129
|
|
@@ -145,9 +142,6 @@ msgstr "建立工作範本"
|
|
145
142
|
msgid "Create a recurring job"
|
146
143
|
msgstr "建立週期性工作"
|
147
144
|
|
148
|
-
msgid "Create a template input"
|
149
|
-
msgstr "建立範本輸入"
|
150
|
-
|
151
145
|
msgid "Default SSH key passphrase"
|
152
146
|
msgstr ""
|
153
147
|
|
@@ -172,9 +166,6 @@ msgstr "刪除外部輸入集"
|
|
172
166
|
msgid "Delete a job template"
|
173
167
|
msgstr "刪除工作範本"
|
174
168
|
|
175
|
-
msgid "Delete a template input"
|
176
|
-
msgstr "刪除範本輸入"
|
177
|
-
|
178
169
|
msgid "Description"
|
179
170
|
msgstr "說明"
|
180
171
|
|
@@ -238,12 +229,6 @@ msgstr "退出狀態:%s"
|
|
238
229
|
msgid "Export a job template to ERB"
|
239
230
|
msgstr ""
|
240
231
|
|
241
|
-
msgid "Fact name, used when input type is fact"
|
242
|
-
msgstr "事實名稱,當輸入類型是 fact 時使用"
|
243
|
-
|
244
|
-
msgid "Fact value"
|
245
|
-
msgstr "詳情值"
|
246
|
-
|
247
232
|
msgid "Failed"
|
248
233
|
msgstr "已失敗"
|
249
234
|
|
@@ -310,24 +295,9 @@ msgstr "這表示如果不能在這時間之前開始,就應該取消動作。
|
|
310
295
|
msgid "Input"
|
311
296
|
msgstr "輸入"
|
312
297
|
|
313
|
-
msgid "Input description"
|
314
|
-
msgstr "輸入的描述"
|
315
|
-
|
316
|
-
msgid "Input is advanced"
|
317
|
-
msgstr "輸入是進階的"
|
318
|
-
|
319
|
-
msgid "Input is required"
|
320
|
-
msgstr "需要輸入"
|
321
|
-
|
322
|
-
msgid "Input name"
|
323
|
-
msgstr "輸入的名稱"
|
324
|
-
|
325
298
|
msgid "Input set description"
|
326
299
|
msgstr "輸入集的描述"
|
327
300
|
|
328
|
-
msgid "Input type"
|
329
|
-
msgstr "輸入類型"
|
330
|
-
|
331
301
|
msgid "Inputs to use"
|
332
302
|
msgstr "要使用的輸入"
|
333
303
|
|
@@ -427,9 +397,6 @@ msgstr "列出各個組織的工作範本"
|
|
427
397
|
msgid "List remote execution features"
|
428
398
|
msgstr "列出遠端執行功能"
|
429
399
|
|
430
|
-
msgid "List template inputs"
|
431
|
-
msgstr "列出範本輸入"
|
432
|
-
|
433
400
|
msgid "List template invocations belonging to job invocation"
|
434
401
|
msgstr ""
|
435
402
|
|
@@ -511,15 +478,6 @@ msgstr "供應者與範本"
|
|
511
478
|
msgid "Proxies"
|
512
479
|
msgstr "代理伺服器"
|
513
480
|
|
514
|
-
msgid "Puppet class name, used when input type is puppet_parameter"
|
515
|
-
msgstr "puppet class 名稱,當輸入類型是 puppet_parameter 時使用"
|
516
|
-
|
517
|
-
msgid "Puppet parameter"
|
518
|
-
msgstr "Puppet 參數"
|
519
|
-
|
520
|
-
msgid "Puppet parameter name, used when input type is puppet_parameter"
|
521
|
-
msgstr "puppet 參數名稱,當輸入類型是 puppet_parameter 時使用"
|
522
|
-
|
523
481
|
msgid "Recurring logic"
|
524
482
|
msgstr "週期邏輯"
|
525
483
|
|
@@ -637,9 +595,6 @@ msgstr ""
|
|
637
595
|
msgid "Select as many remote execution proxies as applicable for this subnet. When multiple proxies with the same provider are added, actions will be load balanced among them."
|
638
596
|
msgstr "為此子網路儘可能選擇遠端執行代理。加入有著同樣供應者的多重代理之後,動作就會在這些代理上進行負載平衡。"
|
639
597
|
|
640
|
-
msgid "Selectable values for user inputs"
|
641
|
-
msgstr "使用者輸入可選擇的值"
|
642
|
-
|
643
598
|
msgid "Set to distribute over"
|
644
599
|
msgstr ""
|
645
600
|
|
@@ -658,9 +613,6 @@ msgstr "顯示工作範本的詳情"
|
|
658
613
|
msgid "Show remote execution feature"
|
659
614
|
msgstr "顯示遠端執行功能"
|
660
615
|
|
661
|
-
msgid "Show template input details"
|
662
|
-
msgstr "顯示範本輸入的詳細資料"
|
663
|
-
|
664
616
|
msgid "Snippet"
|
665
617
|
msgstr "程式碼片段"
|
666
618
|
|
@@ -709,9 +661,6 @@ msgstr ""
|
|
709
661
|
msgid "Template Invocation for %s"
|
710
662
|
msgstr ""
|
711
663
|
|
712
|
-
msgid "Template input"
|
713
|
-
msgstr "範本輸入"
|
714
|
-
|
715
664
|
msgid "Template name"
|
716
665
|
msgstr "範本名稱"
|
717
666
|
|
@@ -846,9 +795,6 @@ msgstr "更新外部輸入集"
|
|
846
795
|
msgid "Update a job template"
|
847
796
|
msgstr "更新工作範本"
|
848
797
|
|
849
|
-
msgid "Update a template input"
|
850
|
-
msgstr "更新範本輸入"
|
851
|
-
|
852
798
|
msgid "Use default description template"
|
853
799
|
msgstr "使用預設的描述範本"
|
854
800
|
|
@@ -870,15 +816,6 @@ msgstr "使用者輸入"
|
|
870
816
|
msgid "Value"
|
871
817
|
msgstr "值"
|
872
818
|
|
873
|
-
msgid "Value for required input '%s' was not specified"
|
874
|
-
msgstr "所需輸入的值 '%s' 並未指定"
|
875
|
-
|
876
|
-
msgid "Variable"
|
877
|
-
msgstr "變數"
|
878
|
-
|
879
|
-
msgid "Variable name, used when input type is variable"
|
880
|
-
msgstr "變數名稱,當輸入類型是 variable 時使用"
|
881
|
-
|
882
819
|
msgid "What command should be used to switch to the effective user. One of %s"
|
883
820
|
msgstr "該用哪個指令來切換至有效的使用者。%s 之一"
|
884
821
|
|
@@ -917,9 +854,6 @@ msgstr ""
|
|
917
854
|
msgid "You are not allowed to see the currently assigned template. Saving the form now would unassign the template."
|
918
855
|
msgstr "您不能看到目前指定的範本。現在儲存表單會取消指定範本。"
|
919
856
|
|
920
|
-
msgid "add a input for this template"
|
921
|
-
msgstr "新增輸入至此範本"
|
922
|
-
|
923
857
|
msgid "add an input set for this template to reference a different template inputs"
|
924
858
|
msgstr "為此範本新增輸入集,以參照至不同的範本輸入"
|
925
859
|
|
@@ -962,9 +896,6 @@ msgstr "已排程"
|
|
962
896
|
msgid "queued to start executing in %{time}"
|
963
897
|
msgstr ""
|
964
898
|
|
965
|
-
msgid "remove template input"
|
966
|
-
msgstr "移除範本輸入"
|
967
|
-
|
968
899
|
msgid "remove template input set"
|
969
900
|
msgstr "移除範本輸入集"
|
970
901
|
|
@@ -22,11 +22,6 @@ FactoryBot.define do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
factory :template_input do |f|
|
26
|
-
f.sequence(:name) { |n| "Template input #{n}" }
|
27
|
-
f.input_type 'user'
|
28
|
-
end
|
29
|
-
|
30
25
|
factory :foreign_input_set
|
31
26
|
|
32
27
|
factory :targeting do |f|
|
@@ -58,6 +53,12 @@ FactoryBot.define do
|
|
58
53
|
invocation.task = FactoryBot.build(:some_task)
|
59
54
|
end
|
60
55
|
end
|
56
|
+
|
57
|
+
trait :with_unplanned_host do
|
58
|
+
after(:build) do |invocation, _evaluator|
|
59
|
+
invocation.targeting.hosts << FactoryBot.build(:host)
|
60
|
+
end
|
61
|
+
end
|
61
62
|
end
|
62
63
|
|
63
64
|
factory :remote_execution_provider do |f|
|
@@ -122,6 +122,15 @@ module Api
|
|
122
122
|
assert_response :success
|
123
123
|
end
|
124
124
|
|
125
|
+
test 'should fail with 404 for non-existing job invocation' do
|
126
|
+
invocation_id = @invocation.id + 1
|
127
|
+
assert_empty JobInvocation.where(:id => invocation_id)
|
128
|
+
get :output, params: { :job_invocation_id => invocation_id, :host_id => 1234 }
|
129
|
+
result = ActiveSupport::JSON.decode(@response.body)
|
130
|
+
assert_equal result['message'], "Job invocation not found by id '#{invocation_id}'"
|
131
|
+
assert_response :missing
|
132
|
+
end
|
133
|
+
|
125
134
|
test 'should cancel a job' do
|
126
135
|
@invocation.task.expects(:cancellable?).returns(true)
|
127
136
|
@invocation.task.expects(:cancel).returns(true)
|
@@ -184,6 +193,7 @@ module Api
|
|
184
193
|
test 'should rerun failed only' do
|
185
194
|
@invocation = FactoryBot.create(:job_invocation, :with_template, :with_failed_task)
|
186
195
|
@invocation.job_category = @invocation.pattern_template_invocations.first.template.job_category
|
196
|
+
@invocation.targeting.hosts = @invocation.template_invocations.map(&:host)
|
187
197
|
@invocation.save!
|
188
198
|
JobInvocation.any_instance.expects(:generate_description)
|
189
199
|
JobInvocationComposer.any_instance
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'test_plugin_helper'
|
2
2
|
|
3
3
|
class InputTemplateRendererTest < ActiveSupport::TestCase
|
4
|
+
let(:host) { FactoryBot.build(:host) }
|
5
|
+
|
4
6
|
context 'renderer for simple template without inputs' do
|
5
7
|
let(:renderer) { InputTemplateRenderer.new(FactoryBot.build(:job_template, :template => 'id <%= preview? %>')) }
|
6
8
|
|
@@ -11,6 +13,12 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
11
13
|
it 'should render preview' do
|
12
14
|
renderer.preview.must_equal 'id true'
|
13
15
|
end
|
16
|
+
|
17
|
+
it 'should allow accessing current_user' do
|
18
|
+
setup_user(:view_job_templates)
|
19
|
+
renderer = InputTemplateRenderer.new(FactoryBot.build(:job_template, :template => "They call me '<%= current_user %>'"))
|
20
|
+
renderer.preview.must_equal "They call me '#{User.current.login}'"
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
24
|
context 'renderer for template with user input used' do
|
@@ -53,12 +61,6 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
53
61
|
end
|
54
62
|
|
55
63
|
describe 'rendering' do
|
56
|
-
it 'cannot render the content without job invocation' do
|
57
|
-
refute result
|
58
|
-
renderer.error_message.wont_be_nil
|
59
|
-
renderer.error_message.wont_be_empty
|
60
|
-
end
|
61
|
-
|
62
64
|
it 'can preview' do
|
63
65
|
renderer.preview.must_equal 'service restart $USER_INPUT[service_name]'
|
64
66
|
end
|
@@ -66,6 +68,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
66
68
|
context 'with invocation specified and a required input' do
|
67
69
|
before do
|
68
70
|
template.template_inputs.first.update_attributes(:required => true)
|
71
|
+
template_invocation.reload
|
69
72
|
renderer.invocation = template_invocation
|
70
73
|
end
|
71
74
|
|
@@ -82,8 +85,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
82
85
|
:template_invocation => template_invocation,
|
83
86
|
:template_input => template.template_inputs.first,
|
84
87
|
:value => 'foreman')
|
88
|
+
template_invocation.reload # need to get input_values findable
|
85
89
|
renderer.invocation = template_invocation
|
86
|
-
renderer.invocation.reload
|
87
90
|
end
|
88
91
|
|
89
92
|
it 'can render with job invocation with corresponding value' do
|
@@ -246,8 +249,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
246
249
|
end
|
247
250
|
|
248
251
|
before do
|
252
|
+
template_invocation.reload
|
249
253
|
renderer.invocation = template_invocation
|
250
|
-
renderer.invocation.reload
|
251
254
|
end
|
252
255
|
|
253
256
|
it 'can render with job invocation with corresponding value' do
|
@@ -266,29 +269,57 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
266
269
|
end
|
267
270
|
|
268
271
|
context 'with options specified' do
|
269
|
-
|
270
272
|
let(:job_invocation) { FactoryBot.create(:job_invocation) }
|
271
273
|
let(:template_invocation) { FactoryBot.build(:template_invocation, :template => template) }
|
272
274
|
let(:result) { renderer.render }
|
275
|
+
let(:required) { false }
|
276
|
+
let(:input) do
|
277
|
+
FactoryBot.create(:template_invocation_input_value,
|
278
|
+
:template_invocation => template_invocation,
|
279
|
+
:template_input => template.template_inputs.first,
|
280
|
+
:value => 'foreman')
|
281
|
+
end
|
273
282
|
|
274
283
|
before do
|
275
|
-
template.template_inputs << FactoryBot.build(:template_input, :name => 'service_name', :input_type => 'user', :options => "httpd\nforeman")
|
284
|
+
template.template_inputs << FactoryBot.build(:template_input, :name => 'service_name', :input_type => 'user', :options => "httpd\nforeman", :required => required)
|
285
|
+
job_invocation.template_invocations << template_invocation
|
286
|
+
input
|
287
|
+
template_invocation.reload
|
288
|
+
renderer.invocation = template_invocation
|
276
289
|
end
|
277
290
|
|
278
291
|
context 'with a valid input defined' do
|
279
|
-
|
280
|
-
|
281
|
-
|
292
|
+
context 'with an optional input' do
|
293
|
+
it 'can render with job invocation with corresponding value' do
|
294
|
+
result.must_equal 'service restart foreman'
|
295
|
+
end
|
296
|
+
end
|
282
297
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
298
|
+
context 'with required input' do
|
299
|
+
let(:required) { true }
|
300
|
+
|
301
|
+
it 'renders the template when the input is provided' do
|
302
|
+
result.must_equal 'service restart foreman'
|
303
|
+
end
|
288
304
|
end
|
305
|
+
end
|
289
306
|
|
290
|
-
|
291
|
-
|
307
|
+
context 'without provided input' do
|
308
|
+
let(:input) { nil }
|
309
|
+
|
310
|
+
context 'with optional input' do
|
311
|
+
it 'renders the template' do
|
312
|
+
result.must_equal 'service restart '
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
context 'with required input' do
|
317
|
+
let(:required) { true }
|
318
|
+
|
319
|
+
it 'renders the template' do
|
320
|
+
result
|
321
|
+
assert_match(/Value for required input '.*' was not specified/, renderer.error_message)
|
322
|
+
end
|
292
323
|
end
|
293
324
|
end
|
294
325
|
end
|
@@ -299,7 +330,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
299
330
|
let(:renderer) { InputTemplateRenderer.new(template) }
|
300
331
|
|
301
332
|
context 'with matching input defined' do
|
302
|
-
before { renderer.template.template_inputs<< FactoryBot.build(:template_input, :name => 'issue', :input_type => 'fact', :fact_name => 'issue') }
|
333
|
+
before { renderer.template.template_inputs<< FactoryBot.build(:template_input, :name => 'issue', :input_type => 'fact', :fact_name => 'issue', :required => true) }
|
303
334
|
let(:result) { renderer.render }
|
304
335
|
|
305
336
|
describe 'rendering' do
|
@@ -379,8 +379,8 @@ class JobInvocationComposerTest < ActiveSupport::TestCase
|
|
379
379
|
end
|
380
380
|
end
|
381
381
|
|
382
|
-
describe '#
|
383
|
-
let(:value1) { composer.
|
382
|
+
describe '#input_value_for(input)' do
|
383
|
+
let(:value1) { composer.input_value_for(input1) }
|
384
384
|
it 'returns new empty input value if there is no invocation' do
|
385
385
|
assert value1.new_record?
|
386
386
|
value1.value.must_be_empty
|
@@ -188,4 +188,40 @@ class JobInvocationTest < ActiveSupport::TestCase
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
+
describe '#failed_hosts' do
|
192
|
+
let(:invocation) do
|
193
|
+
invocation = FactoryBot.build(:job_invocation, :with_template, :with_task, :with_failed_task, :with_unplanned_host)
|
194
|
+
invocation.template_invocations.each { |ti| invocation.targeting.hosts << ti.host }
|
195
|
+
invocation.save!
|
196
|
+
invocation
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'returns only failed hosts when not #finished?' do
|
200
|
+
invocation.stubs(:finished?).returns(false)
|
201
|
+
invocation.failed_hosts.count.must_equal 1
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'returns failed hosts and hosts without task when #finished?' do
|
205
|
+
invocation.stubs(:finished?).returns(true)
|
206
|
+
invocation.failed_hosts.count.must_equal 2
|
207
|
+
end
|
208
|
+
|
209
|
+
describe '#failed_template_invocations' do
|
210
|
+
it 'finds only failed template invocations' do
|
211
|
+
template_invocations = invocation.send(:failed_template_invocations)
|
212
|
+
template_invocations.count.must_equal 1
|
213
|
+
template_invocation = template_invocations.first
|
214
|
+
template_invocation.run_host_job_task.result.must_equal 'error'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe '#not_failed_template_invocations' do
|
219
|
+
it 'finds only non-failed template invocations' do
|
220
|
+
template_invocations = invocation.send(:not_failed_template_invocations)
|
221
|
+
template_invocations.count.must_equal 1
|
222
|
+
template_invocation = template_invocations.first
|
223
|
+
template_invocation.run_host_job_task.result.must_equal 'success'
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
191
227
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Remote Execution team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -148,13 +148,11 @@ files:
|
|
148
148
|
- app/controllers/api/v2/job_invocations_controller.rb
|
149
149
|
- app/controllers/api/v2/job_templates_controller.rb
|
150
150
|
- app/controllers/api/v2/remote_execution_features_controller.rb
|
151
|
-
- app/controllers/api/v2/template_inputs_controller.rb
|
152
151
|
- app/controllers/api/v2/template_invocations_controller.rb
|
153
152
|
- app/controllers/concerns/foreman/controller/parameters/foreign_input_set.rb
|
154
153
|
- app/controllers/concerns/foreman/controller/parameters/job_template.rb
|
155
154
|
- app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb
|
156
155
|
- app/controllers/concerns/foreman/controller/parameters/targeting.rb
|
157
|
-
- app/controllers/concerns/foreman/controller/parameters/template_input.rb
|
158
156
|
- app/controllers/job_invocations_controller.rb
|
159
157
|
- app/controllers/job_templates_controller.rb
|
160
158
|
- app/controllers/remote_execution_features_controller.rb
|
@@ -182,6 +180,8 @@ files:
|
|
182
180
|
- app/models/concerns/foreman_remote_execution/subnet_extensions.rb
|
183
181
|
- app/models/concerns/foreman_remote_execution/taxonomy_extensions.rb
|
184
182
|
- app/models/concerns/foreman_remote_execution/template_extensions.rb
|
183
|
+
- app/models/concerns/foreman_remote_execution/template_input_extensions.rb
|
184
|
+
- app/models/concerns/foreman_remote_execution/template_overrides.rb
|
185
185
|
- app/models/concerns/foreman_remote_execution/user_extensions.rb
|
186
186
|
- app/models/foreign_input_set.rb
|
187
187
|
- app/models/host_status/execution_status.rb
|
@@ -198,7 +198,6 @@ files:
|
|
198
198
|
- app/models/target_remote_execution_proxy.rb
|
199
199
|
- app/models/targeting.rb
|
200
200
|
- app/models/targeting_host.rb
|
201
|
-
- app/models/template_input.rb
|
202
201
|
- app/models/template_invocation.rb
|
203
202
|
- app/models/template_invocation_input_value.rb
|
204
203
|
- app/overrides/execution_interface.rb
|
@@ -225,11 +224,7 @@ files:
|
|
225
224
|
- app/views/api/v2/remote_execution_features/index.json.rabl
|
226
225
|
- app/views/api/v2/remote_execution_features/main.json.rabl
|
227
226
|
- app/views/api/v2/remote_execution_features/show.json.rabl
|
228
|
-
- app/views/api/v2/
|
229
|
-
- app/views/api/v2/template_inputs/create.json.rabl
|
230
|
-
- app/views/api/v2/template_inputs/index.json.rabl
|
231
|
-
- app/views/api/v2/template_inputs/main.json.rabl
|
232
|
-
- app/views/api/v2/template_inputs/show.json.rabl
|
227
|
+
- app/views/api/v2/smart_proxies/pubkey.json.rabl
|
233
228
|
- app/views/api/v2/template_invocations/base.json.rabl
|
234
229
|
- app/views/api/v2/template_invocations/template_invocations.json.rabl
|
235
230
|
- app/views/dashboard/.gitkeep
|
@@ -268,13 +263,12 @@ files:
|
|
268
263
|
- app/views/remote_execution_features/index.html.erb
|
269
264
|
- app/views/remote_execution_features/show.html.erb
|
270
265
|
- app/views/template_inputs/_foreign_input_set_form.html.erb
|
271
|
-
- app/views/template_inputs/_form.html.erb
|
272
|
-
- app/views/template_inputs/_invocation_form.html.erb
|
273
266
|
- app/views/template_invocations/_output_line_set.html.erb
|
274
267
|
- app/views/template_invocations/_refresh.js.erb
|
275
268
|
- app/views/template_invocations/show.html.erb
|
276
269
|
- app/views/template_invocations/show.js.erb
|
277
270
|
- app/views/templates/README.md
|
271
|
+
- app/views/templates/ssh/module_action.erb
|
278
272
|
- app/views/templates/ssh/package_action.erb
|
279
273
|
- app/views/templates/ssh/power_action.erb
|
280
274
|
- app/views/templates/ssh/puppet_run_once.erb
|
@@ -282,7 +276,6 @@ files:
|
|
282
276
|
- app/views/templates/ssh/service_action.erb
|
283
277
|
- config/routes.rb
|
284
278
|
- db/migrate/20150612121541_add_job_template_to_template.rb
|
285
|
-
- db/migrate/20150616080015_create_template_input.rb
|
286
279
|
- db/migrate/20150708133241_add_targeting.rb
|
287
280
|
- db/migrate/20150708133242_add_invocation.rb
|
288
281
|
- db/migrate/20150708133305_add_template_invocation.rb
|
@@ -290,7 +283,6 @@ files:
|
|
290
283
|
- db/migrate/20150812145900_add_last_task_id_to_job_invocation.rb
|
291
284
|
- db/migrate/20150826191632_create_target_remote_execution_proxies.rb
|
292
285
|
- db/migrate/20150827144500_change_targeting_search_query_type.rb
|
293
|
-
- db/migrate/20150827152730_add_options_to_template_input.rb
|
294
286
|
- db/migrate/20150903192731_add_execution_to_interface.rb
|
295
287
|
- db/migrate/20150923125825_add_job_invocation_task_group.rb
|
296
288
|
- db/migrate/20151013135415_add_pub_key_to_smart_proxy.rb
|
@@ -310,7 +302,6 @@ files:
|
|
310
302
|
- db/migrate/20160114125628_rename_job_name_to_job_category.rb
|
311
303
|
- db/migrate/20160118124600_create_remote_execution_features.rb
|
312
304
|
- db/migrate/20160125155108_make_job_template_name_unique.rb
|
313
|
-
- db/migrate/20160127134031_add_advanced_to_template_input.rb
|
314
305
|
- db/migrate/20160127162711_reword_puppet_template_description.rb
|
315
306
|
- db/migrate/20160203104056_add_concurrency_options_to_job_invocation.rb
|
316
307
|
- db/migrate/20160926225841_update_template_input_value.rb
|
@@ -366,7 +357,6 @@ files:
|
|
366
357
|
- test/functional/api/v2/job_invocations_controller_test.rb
|
367
358
|
- test/functional/api/v2/job_templates_controller_test.rb
|
368
359
|
- test/functional/api/v2/remote_execution_features_controller_test.rb
|
369
|
-
- test/functional/api/v2/template_inputs_controller_test.rb
|
370
360
|
- test/functional/api/v2/template_invocations_controller_test.rb
|
371
361
|
- test/functional/job_invocations_controller_test.rb
|
372
362
|
- test/functional/job_templates_controller_test.rb
|
@@ -386,7 +376,6 @@ files:
|
|
386
376
|
- test/unit/remote_execution_provider_test.rb
|
387
377
|
- test/unit/renderer_scope_input.rb
|
388
378
|
- test/unit/targeting_test.rb
|
389
|
-
- test/unit/template_input_test.rb
|
390
379
|
- test/unit/template_invocation_input_value_test.rb
|
391
380
|
- webpack/index.js
|
392
381
|
- webpack/react_app/components/jobInvocations/AggregateStatus/index.js
|
@@ -432,7 +421,6 @@ test_files:
|
|
432
421
|
- test/functional/api/v2/job_invocations_controller_test.rb
|
433
422
|
- test/functional/api/v2/job_templates_controller_test.rb
|
434
423
|
- test/functional/api/v2/remote_execution_features_controller_test.rb
|
435
|
-
- test/functional/api/v2/template_inputs_controller_test.rb
|
436
424
|
- test/functional/api/v2/template_invocations_controller_test.rb
|
437
425
|
- test/functional/job_invocations_controller_test.rb
|
438
426
|
- test/functional/job_templates_controller_test.rb
|
@@ -452,5 +440,4 @@ test_files:
|
|
452
440
|
- test/unit/remote_execution_provider_test.rb
|
453
441
|
- test/unit/renderer_scope_input.rb
|
454
442
|
- test/unit/targeting_test.rb
|
455
|
-
- test/unit/template_input_test.rb
|
456
443
|
- test/unit/template_invocation_input_value_test.rb
|