foreman_remote_execution 12.0.5 → 13.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +4 -1
  3. data/.github/workflows/js_ci.yml +1 -1
  4. data/.github/workflows/release.yml +4 -2
  5. data/.github/workflows/ruby_ci.yml +16 -81
  6. data/.packit.yaml +8 -3
  7. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +23 -14
  8. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +22 -4
  9. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +23 -14
  10. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +23 -14
  11. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +23 -14
  12. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +23 -14
  13. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +23 -14
  14. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +23 -14
  15. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +23 -14
  16. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +23 -14
  17. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +23 -14
  18. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +23 -14
  19. data/app/controllers/ui_job_wizard_controller.rb +1 -1
  20. data/app/helpers/job_invocations_helper.rb +1 -1
  21. data/app/helpers/remote_execution_helper.rb +2 -2
  22. data/app/lib/actions/remote_execution/proxy_action.rb +1 -1
  23. data/app/lib/actions/remote_execution/run_host_job.rb +9 -17
  24. data/app/models/concerns/foreman_remote_execution/host_extensions.rb +8 -0
  25. data/app/models/host_status/execution_status.rb +2 -2
  26. data/app/models/job_invocation_composer.rb +4 -3
  27. data/app/views/api/v2/job_invocations/base.json.rabl +5 -3
  28. data/app/views/job_invocations/_preview_hosts_list.html.erb +1 -1
  29. data/app/views/job_invocations/show.html.erb +12 -5
  30. data/app/views/job_invocations/show.js.erb +8 -1
  31. data/app/views/job_invocations/welcome.html.erb +1 -1
  32. data/app/views/template_invocations/_refresh.js.erb +10 -4
  33. data/app/views/template_invocations/show.html.erb +2 -2
  34. data/app/views/templates/script/convert2rhel_analyze.erb +1 -12
  35. data/app/views/templates/script/package_action.erb +11 -1
  36. data/app/views/templates/script/puppet_run_once.erb +3 -3
  37. data/lib/foreman_remote_execution/engine.rb +1 -1
  38. data/lib/foreman_remote_execution/version.rb +1 -1
  39. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/de/foreman_remote_execution.po +24 -6
  41. data/locale/en/foreman_remote_execution.po +24 -6
  42. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  43. data/locale/en_GB/foreman_remote_execution.po +24 -6
  44. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  45. data/locale/es/foreman_remote_execution.po +24 -6
  46. data/locale/foreman_remote_execution.pot +170 -142
  47. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  48. data/locale/fr/foreman_remote_execution.po +24 -6
  49. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  50. data/locale/ja/foreman_remote_execution.po +24 -6
  51. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  52. data/locale/ka/foreman_remote_execution.po +24 -6
  53. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  54. data/locale/ko/foreman_remote_execution.po +24 -6
  55. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  56. data/locale/pt_BR/foreman_remote_execution.po +24 -6
  57. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  58. data/locale/ru/foreman_remote_execution.po +24 -6
  59. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  60. data/locale/zh_CN/foreman_remote_execution.po +24 -6
  61. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  62. data/locale/zh_TW/foreman_remote_execution.po +24 -6
  63. data/package.json +7 -11
  64. data/test/functional/api/v2/job_invocations_controller_test.rb +7 -7
  65. data/test/functional/api/v2/template_invocations_controller_test.rb +3 -3
  66. data/test/helpers/remote_execution_helper_test.rb +8 -7
  67. data/test/unit/actions/run_host_job_test.rb +1 -1
  68. data/test/unit/actions/run_hosts_job_test.rb +11 -11
  69. data/test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb +5 -5
  70. data/test/unit/concerns/host_extensions_test.rb +34 -34
  71. data/test/unit/concerns/nic_extensions_test.rb +1 -1
  72. data/test/unit/execution_task_status_mapper_test.rb +10 -10
  73. data/test/unit/input_template_renderer_test.rb +53 -49
  74. data/test/unit/job_invocation_composer_test.rb +109 -81
  75. data/test/unit/job_invocation_test.rb +25 -25
  76. data/test/unit/job_template_effective_user_test.rb +3 -3
  77. data/test/unit/job_template_test.rb +28 -28
  78. data/test/unit/remote_execution_feature_test.rb +14 -14
  79. data/test/unit/remote_execution_provider_test.rb +39 -39
  80. data/test/unit/renderer_scope_input_test.rb +6 -6
  81. data/test/unit/targeting_test.rb +32 -32
  82. data/webpack/JobInvocationDetail/JobInvocationConstants.js +10 -0
  83. data/webpack/JobInvocationDetail/JobInvocationDetail.scss +38 -0
  84. data/webpack/JobInvocationDetail/JobInvocationOverview.js +13 -25
  85. data/webpack/JobInvocationDetail/JobInvocationSystemStatusChart.js +153 -0
  86. data/webpack/JobInvocationDetail/index.js +48 -10
  87. data/webpack/JobWizard/Footer.js +5 -1
  88. data/webpack/JobWizard/JobWizardConstants.js +4 -0
  89. data/webpack/JobWizard/JobWizardPageRerun.js +3 -0
  90. data/webpack/JobWizard/JobWizardSelectors.js +31 -3
  91. data/webpack/JobWizard/PermissionDenied.js +64 -0
  92. data/webpack/JobWizard/StartsBeforeErrorAlert.js +1 -0
  93. data/webpack/JobWizard/__tests__/fixtures.js +3 -3
  94. data/webpack/JobWizard/autofill.js +8 -4
  95. data/webpack/JobWizard/index.js +41 -1
  96. data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +8 -1
  97. data/webpack/JobWizard/steps/AdvancedFields/Fields.js +7 -0
  98. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +41 -7
  99. data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +7 -3
  100. data/webpack/JobWizard/steps/HostsAndInputs/SelectGQL.js +1 -0
  101. data/webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js +21 -7
  102. data/webpack/JobWizard/steps/HostsAndInputs/hosts.gql +1 -0
  103. data/webpack/JobWizard/steps/HostsAndInputs/index.js +27 -2
  104. data/webpack/JobWizard/steps/ReviewDetails/index.js +7 -2
  105. data/webpack/JobWizard/steps/Schedule/PurposeField.js +1 -0
  106. data/webpack/JobWizard/steps/Schedule/QueryType.js +2 -0
  107. data/webpack/JobWizard/steps/Schedule/RepeatCron.js +1 -0
  108. data/webpack/JobWizard/steps/Schedule/RepeatHour.js +2 -0
  109. data/webpack/JobWizard/steps/Schedule/RepeatMonth.js +1 -0
  110. data/webpack/JobWizard/steps/Schedule/RepeatWeek.js +1 -0
  111. data/webpack/JobWizard/steps/Schedule/ScheduleFuture.js +2 -0
  112. data/webpack/JobWizard/steps/Schedule/ScheduleRecurring.js +6 -0
  113. data/webpack/JobWizard/steps/Schedule/ScheduleType.js +3 -0
  114. data/webpack/JobWizard/steps/form/FormHelpers.js +1 -0
  115. data/webpack/JobWizard/steps/form/GroupedSelectField.js +1 -0
  116. data/webpack/JobWizard/steps/form/NumberInput.js +1 -0
  117. data/webpack/JobWizard/steps/form/ResourceSelect.js +1 -0
  118. data/webpack/JobWizard/steps/form/SearchSelect.js +4 -1
  119. data/webpack/JobWizard/steps/form/SelectField.js +1 -0
  120. data/webpack/JobWizard/steps/form/WizardTitle.js +6 -1
  121. data/webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js +2 -0
  122. data/webpack/__mocks__/foremanReact/routes/Hosts/constants.js +1 -0
  123. data/webpack/react_app/components/FeaturesDropdown/index.js +1 -0
  124. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +3 -0
  125. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -1
  126. data/webpack/react_app/components/RegistrationExtension/RexInterface.js +1 -0
  127. data/webpack/react_app/components/RegistrationExtension/RexPull.js +1 -0
  128. data/webpack/react_app/components/RegistrationExtension/__tests__/__snapshots__/RexInterface.test.js.snap +1 -0
  129. metadata +10 -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
- _(renderer.render).must_equal 'id false'
10
+ assert_equal 'id false', renderer.render
11
11
  end
12
12
 
13
13
  it 'should render preview' do
14
- _(renderer.preview).must_equal 'id true'
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
- _(renderer.preview).must_equal "They call me '#{User.current.login}'"
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 { _(result).must_equal false }
31
+ it 'should return false' do
32
+ refute result
33
+ end
32
34
 
33
- it 'registers an error' do
35
+ it 'should register an error' do
34
36
  result # let is lazy
35
- _(renderer.error_message).wont_be_nil
36
- _(renderer.error_message).wont_be_empty
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 { _(result).must_equal false }
44
+ it 'should return false' do
45
+ refute result
46
+ end
43
47
 
44
- it 'registers an error' do
48
+ it 'should register an error' do
45
49
  result # let is lazy
46
- _(renderer.error_message).wont_be_nil
47
- _(renderer.error_message).wont_be_empty
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
- _(renderer.preview).must_equal 'service restart $USER_INPUT[service_name]'
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
- _(renderer.error_message).wont_be_nil
78
- _(renderer.error_message).wont_be_empty
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
- _(renderer.render).must_equal 'service restart foreman'
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
- _(renderer.render).must_equal 'service restart '
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
- _(renderer.error_message).must_include 'Recursive rendering of templates detected'
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
- _(template.template_inputs_with_foreign.map(&:name).sort).must_equal ['action', 'debug', 'package']
198
- _(template_2.template_inputs_with_foreign.map(&:name).sort).must_equal ['action', 'debug', 'package']
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
- _(template.template_inputs_with_foreign.map(&:name).sort).must_equal ['package']
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
- _(template.template_inputs_with_foreign.map(&:name).sort).must_equal ['package']
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
- _(renderer.error_message).must_be_nil
241
- _(rendered).must_equal 'yum -y install zsh'
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
- _(renderer.error_message).must_be_nil
259
- _(rendered).must_equal 'yum -y install zsh'
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
- _(renderer.error_message).must_be_nil
267
- _(rendered).must_equal 'yum -y install '
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
- _(result).must_equal 'service restart foreman'
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
- _(result).must_equal 'service restart foreman'
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
- _(result).must_equal 'service restart '
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
- _(renderer.error_message).wont_be_nil
344
- _(renderer.error_message).wont_be_empty
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
- _(renderer.error_message).wont_be_nil
358
- _(renderer.error_message).wont_be_empty
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
- _(renderer.preview).must_equal 'echo $FACT_INPUT[issue] > /etc/issue'
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
- _(renderer.error_message).wont_be_nil
380
- _(renderer.error_message).wont_be_empty
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
- _(renderer.preview).must_equal 'echo $FACT_INPUT[issue] > /etc/issue'
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
- _(result).must_equal 'echo banner > /etc/issue'
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
- _(renderer.preview).must_equal 'echo $FACT_INPUT[issue] > /etc/issue'
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
- _(result).must_equal 'echo banner > /etc/issue'
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
- _(renderer.error_message).wont_be_nil
442
- _(renderer.error_message).wont_be_empty
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
- _(renderer.error_message).wont_be_nil
459
- _(renderer.error_message).wont_be_empty
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
- _(renderer.preview).must_equal 'echo $VARIABLE_INPUT[client_key] > /etc/chef/client.pem'
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
- _(result).must_equal 'echo RSA KEY > /etc/chef/client.pem'
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
- _(renderer.preview).must_equal 'echo RSA KEY > /etc/chef/client.pem'
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
- _(renderer.preview).must_equal 'echo $VARIABLE_INPUT[client_key] > /etc/chef/client.pem'
497
+ assert_equal 'echo $VARIABLE_INPUT[client_key] > /etc/chef/client.pem', renderer.preview
494
498
  end
495
499
  end
496
500
  end