foreman_remote_execution 12.0.6 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/js_ci.yml +1 -1
- data/.github/workflows/ruby_ci.yml +16 -81
- data/.packit.yaml +8 -3
- data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +22 -4
- data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +23 -14
- data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +23 -14
- data/app/controllers/ui_job_wizard_controller.rb +1 -1
- data/app/helpers/job_invocations_helper.rb +1 -1
- data/app/helpers/remote_execution_helper.rb +2 -2
- data/app/lib/actions/remote_execution/proxy_action.rb +1 -1
- data/app/lib/actions/remote_execution/run_host_job.rb +9 -3
- data/app/models/host_status/execution_status.rb +2 -2
- data/app/views/job_invocations/_preview_hosts_list.html.erb +1 -1
- data/app/views/job_invocations/show.html.erb +12 -5
- data/app/views/job_invocations/show.js.erb +8 -1
- data/app/views/job_invocations/welcome.html.erb +1 -1
- data/app/views/template_invocations/_refresh.js.erb +10 -4
- data/app/views/template_invocations/show.html.erb +2 -2
- data/app/views/templates/script/convert2rhel_analyze.erb +12 -1
- data/lib/foreman_remote_execution/engine.rb +1 -1
- 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 +24 -6
- data/locale/en/foreman_remote_execution.po +24 -6
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +24 -6
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +24 -6
- data/locale/foreman_remote_execution.pot +170 -142
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +24 -6
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +24 -6
- data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ka/foreman_remote_execution.po +24 -6
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +24 -6
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +24 -6
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +24 -6
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +24 -6
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +24 -6
- data/package.json +1 -5
- data/test/functional/api/v2/job_invocations_controller_test.rb +7 -7
- data/test/functional/api/v2/template_invocations_controller_test.rb +3 -3
- data/test/helpers/remote_execution_helper_test.rb +8 -7
- data/test/unit/actions/run_host_job_test.rb +1 -1
- data/test/unit/actions/run_hosts_job_test.rb +11 -11
- data/test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb +5 -5
- data/test/unit/concerns/host_extensions_test.rb +34 -34
- data/test/unit/concerns/nic_extensions_test.rb +1 -1
- data/test/unit/execution_task_status_mapper_test.rb +10 -10
- data/test/unit/input_template_renderer_test.rb +53 -49
- data/test/unit/job_invocation_composer_test.rb +78 -78
- data/test/unit/job_invocation_test.rb +25 -25
- data/test/unit/job_template_effective_user_test.rb +3 -3
- data/test/unit/job_template_test.rb +28 -28
- data/test/unit/remote_execution_feature_test.rb +14 -14
- data/test/unit/remote_execution_provider_test.rb +39 -39
- data/test/unit/renderer_scope_input_test.rb +6 -6
- data/test/unit/targeting_test.rb +32 -32
- data/webpack/JobWizard/JobWizardConstants.js +4 -0
- data/webpack/JobWizard/JobWizardSelectors.js +31 -3
- data/webpack/JobWizard/PermissionDenied.js +64 -0
- data/webpack/JobWizard/__tests__/fixtures.js +3 -3
- data/webpack/JobWizard/autofill.js +8 -4
- data/webpack/JobWizard/index.js +40 -1
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +26 -5
- data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +3 -3
- data/webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js +1 -0
- data/webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js +13 -6
- data/webpack/JobWizard/steps/HostsAndInputs/hosts.gql +1 -0
- data/webpack/JobWizard/steps/HostsAndInputs/index.js +21 -1
- data/webpack/JobWizard/steps/ReviewDetails/index.js +3 -2
- data/webpack/JobWizard/steps/form/SearchSelect.js +3 -1
- data/webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js +2 -0
- metadata +7 -6
@@ -7,17 +7,17 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
7
7
|
let(:renderer) { InputTemplateRenderer.new(FactoryBot.build(:job_template, :template => 'id <%= preview? %>')) }
|
8
8
|
|
9
9
|
it 'should render the content' do
|
10
|
-
|
10
|
+
assert_equal 'id false', renderer.render
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should render preview' do
|
14
|
-
|
14
|
+
assert_equal 'id true', renderer.preview
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should allow accessing current_user' do
|
18
18
|
setup_user(:view_job_templates)
|
19
19
|
renderer = InputTemplateRenderer.new(FactoryBot.build(:job_template, :template => "They call me '<%= current_user %>'"))
|
20
|
-
|
20
|
+
assert_equal "They call me '#{User.current.login}'", renderer.preview
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -28,23 +28,27 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
28
28
|
context 'but without input defined' do
|
29
29
|
describe 'rendering' do
|
30
30
|
let(:result) { renderer.render }
|
31
|
-
it
|
31
|
+
it 'should return false' do
|
32
|
+
refute result
|
33
|
+
end
|
32
34
|
|
33
|
-
it '
|
35
|
+
it 'should register an error' do
|
34
36
|
result # let is lazy
|
35
|
-
|
36
|
-
|
37
|
+
assert_not_nil renderer.error_message
|
38
|
+
assert_not_empty renderer.error_message
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
describe 'preview' do
|
41
43
|
let(:result) { renderer.preview }
|
42
|
-
it
|
44
|
+
it 'should return false' do
|
45
|
+
refute result
|
46
|
+
end
|
43
47
|
|
44
|
-
it '
|
48
|
+
it 'should register an error' do
|
45
49
|
result # let is lazy
|
46
|
-
|
47
|
-
|
50
|
+
assert_not_nil renderer.error_message
|
51
|
+
assert_not_empty renderer.error_message
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -62,7 +66,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
62
66
|
|
63
67
|
describe 'rendering' do
|
64
68
|
it 'can preview' do
|
65
|
-
|
69
|
+
assert_equal 'service restart $USER_INPUT[service_name]', renderer.preview
|
66
70
|
end
|
67
71
|
|
68
72
|
context 'with invocation specified and a required input' do
|
@@ -74,8 +78,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
74
78
|
|
75
79
|
it 'cannot render the content' do
|
76
80
|
assert_not result
|
77
|
-
|
78
|
-
|
81
|
+
refute_nil renderer.error_message
|
82
|
+
refute_empty renderer.error_message
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
@@ -90,13 +94,13 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
90
94
|
end
|
91
95
|
|
92
96
|
it 'can render with job invocation with corresponding value' do
|
93
|
-
|
97
|
+
assert_equal 'service restart foreman', renderer.render
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
97
101
|
it 'renders even without an input value' do
|
98
102
|
renderer.invocation = template_invocation
|
99
|
-
|
103
|
+
assert_equal 'service restart ', renderer.render
|
100
104
|
end
|
101
105
|
|
102
106
|
describe 'with circular reference' do
|
@@ -126,7 +130,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
126
130
|
renderer.invocation = FactoryBot.build(:template_invocation, :template => template_without_inputs)
|
127
131
|
renderer.template = template_without_inputs
|
128
132
|
assert_not renderer.render
|
129
|
-
|
133
|
+
assert_includes renderer.error_message, 'Recursive rendering of templates detected'
|
130
134
|
end
|
131
135
|
|
132
136
|
it 'handles circular references in inputs' do
|
@@ -194,8 +198,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
194
198
|
end
|
195
199
|
|
196
200
|
it 'includes all inputs from the imported template' do
|
197
|
-
|
198
|
-
|
201
|
+
assert_equal ['action', 'debug', 'package'], template.template_inputs_with_foreign.map(&:name).sort
|
202
|
+
assert_equal ['action', 'debug', 'package'], template_2.template_inputs_with_foreign.map(&:name).sort
|
199
203
|
end
|
200
204
|
end
|
201
205
|
|
@@ -207,7 +211,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
207
211
|
end
|
208
212
|
|
209
213
|
it 'includes all inputs from the imported template except the listed once' do
|
210
|
-
|
214
|
+
assert_equal ['package'], template.template_inputs_with_foreign.map(&:name).sort
|
211
215
|
end
|
212
216
|
end
|
213
217
|
|
@@ -220,7 +224,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
220
224
|
end
|
221
225
|
|
222
226
|
it 'includes all inputs from the imported template' do
|
223
|
-
|
227
|
+
assert_equal ['package'], template.template_inputs_with_foreign.map(&:name).sort
|
224
228
|
end
|
225
229
|
end
|
226
230
|
end
|
@@ -237,8 +241,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
237
241
|
|
238
242
|
it 'can render with job invocation with corresponding value' do
|
239
243
|
rendered = renderer.render
|
240
|
-
|
241
|
-
|
244
|
+
assert_nil renderer.error_message
|
245
|
+
assert_equal 'yum -y install zsh', rendered
|
242
246
|
end
|
243
247
|
end
|
244
248
|
|
@@ -255,16 +259,16 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
255
259
|
|
256
260
|
it 'can render with job invocation with corresponding value' do
|
257
261
|
rendered = renderer.render
|
258
|
-
|
259
|
-
|
262
|
+
assert_nil renderer.error_message
|
263
|
+
assert_equal 'yum -y install zsh', rendered
|
260
264
|
end
|
261
265
|
end
|
262
266
|
|
263
267
|
it 'renders even without an input value' do
|
264
268
|
renderer.invocation = template_invocation
|
265
269
|
rendered = renderer.render
|
266
|
-
|
267
|
-
|
270
|
+
assert_nil renderer.error_message
|
271
|
+
assert_equal 'yum -y install ', rendered
|
268
272
|
end
|
269
273
|
end
|
270
274
|
|
@@ -291,7 +295,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
291
295
|
context 'with a valid input defined' do
|
292
296
|
context 'with an optional input' do
|
293
297
|
it 'can render with job invocation with corresponding value' do
|
294
|
-
|
298
|
+
assert_equal 'service restart foreman', result
|
295
299
|
end
|
296
300
|
end
|
297
301
|
|
@@ -299,7 +303,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
299
303
|
let(:required) { true }
|
300
304
|
|
301
305
|
it 'renders the template when the input is provided' do
|
302
|
-
|
306
|
+
assert_equal 'service restart foreman', result
|
303
307
|
end
|
304
308
|
end
|
305
309
|
end
|
@@ -309,7 +313,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
309
313
|
|
310
314
|
context 'with optional input' do
|
311
315
|
it 'renders the template' do
|
312
|
-
|
316
|
+
assert_equal 'service restart ', result
|
313
317
|
end
|
314
318
|
end
|
315
319
|
|
@@ -340,8 +344,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
340
344
|
|
341
345
|
it 'registers an error' do
|
342
346
|
result # let is lazy
|
343
|
-
|
344
|
-
|
347
|
+
assert_not_nil renderer.error_message
|
348
|
+
assert_not_empty renderer.error_message
|
345
349
|
end
|
346
350
|
|
347
351
|
context 'with host specified' do
|
@@ -354,14 +358,14 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
354
358
|
|
355
359
|
it 'registers an error' do
|
356
360
|
result # let is lazy
|
357
|
-
|
358
|
-
|
361
|
+
assert_not_nil renderer.error_message
|
362
|
+
assert_not_empty renderer.error_message
|
359
363
|
end
|
360
364
|
end
|
361
365
|
|
362
366
|
describe 'preview' do
|
363
367
|
it 'should render preview' do
|
364
|
-
|
368
|
+
assert_equal 'echo $FACT_INPUT[issue] > /etc/issue', renderer.preview
|
365
369
|
end
|
366
370
|
end
|
367
371
|
|
@@ -376,14 +380,14 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
376
380
|
|
377
381
|
it 'registers an error' do
|
378
382
|
result # let is lazy
|
379
|
-
|
380
|
-
|
383
|
+
assert_not_nil renderer.error_message
|
384
|
+
assert_not_empty renderer.error_message
|
381
385
|
end
|
382
386
|
end
|
383
387
|
|
384
388
|
describe 'preview' do
|
385
389
|
it 'should render preview' do
|
386
|
-
|
390
|
+
assert_equal 'echo $FACT_INPUT[issue] > /etc/issue', renderer.preview
|
387
391
|
end
|
388
392
|
end
|
389
393
|
|
@@ -393,7 +397,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
393
397
|
let(:result) { renderer.render }
|
394
398
|
|
395
399
|
it 'can render with job invocation with corresponding value' do
|
396
|
-
|
400
|
+
assert_equal 'echo banner > /etc/issue', result
|
397
401
|
end
|
398
402
|
end
|
399
403
|
end
|
@@ -402,7 +406,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
402
406
|
|
403
407
|
describe 'preview' do
|
404
408
|
it 'should render preview' do
|
405
|
-
|
409
|
+
assert_equal 'echo $FACT_INPUT[issue] > /etc/issue', renderer.preview
|
406
410
|
end
|
407
411
|
|
408
412
|
context 'with host specified' do
|
@@ -416,7 +420,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
416
420
|
let(:result) { renderer.render }
|
417
421
|
|
418
422
|
it 'uses the value even in preview' do
|
419
|
-
|
423
|
+
assert_equal 'echo banner > /etc/issue', result
|
420
424
|
end
|
421
425
|
end
|
422
426
|
end
|
@@ -438,8 +442,8 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
438
442
|
|
439
443
|
it 'registers an error' do
|
440
444
|
result # let is lazy
|
441
|
-
|
442
|
-
|
445
|
+
refute_nil renderer.error_message
|
446
|
+
refute_empty renderer.error_message
|
443
447
|
end
|
444
448
|
|
445
449
|
context 'with host specified' do
|
@@ -455,14 +459,14 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
455
459
|
|
456
460
|
it 'registers an error' do
|
457
461
|
result # let is lazy
|
458
|
-
|
459
|
-
|
462
|
+
refute_nil renderer.error_message
|
463
|
+
refute_empty renderer.error_message
|
460
464
|
end
|
461
465
|
end
|
462
466
|
|
463
467
|
describe 'preview' do
|
464
468
|
it 'should render preview' do
|
465
|
-
|
469
|
+
assert_equal 'echo $VARIABLE_INPUT[client_key] > /etc/chef/client.pem', renderer.preview
|
466
470
|
end
|
467
471
|
end
|
468
472
|
|
@@ -474,7 +478,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
474
478
|
it 'renders the value from host parameter' do
|
475
479
|
parameter
|
476
480
|
renderer.host.reload
|
477
|
-
|
481
|
+
assert_equal 'echo RSA KEY > /etc/chef/client.pem', result
|
478
482
|
end
|
479
483
|
end
|
480
484
|
|
@@ -482,7 +486,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
482
486
|
it 'should render preview' do
|
483
487
|
parameter
|
484
488
|
renderer.host.reload
|
485
|
-
|
489
|
+
assert_equal 'echo RSA KEY > /etc/chef/client.pem', renderer.preview
|
486
490
|
end
|
487
491
|
end
|
488
492
|
end
|
@@ -490,7 +494,7 @@ class InputTemplateRendererTest < ActiveSupport::TestCase
|
|
490
494
|
|
491
495
|
describe 'preview' do
|
492
496
|
it 'should render preview' do
|
493
|
-
|
497
|
+
assert_equal 'echo $VARIABLE_INPUT[client_key] > /etc/chef/client.pem', renderer.preview
|
494
498
|
end
|
495
499
|
end
|
496
500
|
end
|