foreman_remote_execution 3.0.3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +2 -1
  3. data/.rubocop.yml +80 -50
  4. data/.rubocop_todo.yml +113 -73
  5. data/Gemfile +4 -0
  6. data/app/controllers/api/v2/foreign_input_sets_controller.rb +3 -2
  7. data/app/controllers/api/v2/job_invocations_controller.rb +7 -6
  8. data/app/controllers/api/v2/job_templates_controller.rb +3 -2
  9. data/app/controllers/api/v2/remote_execution_features_controller.rb +3 -2
  10. data/app/controllers/api/v2/template_invocations_controller.rb +1 -1
  11. data/app/controllers/cockpit_controller.rb +1 -0
  12. data/app/controllers/concerns/foreman/controller/parameters/foreign_input_set.rb +1 -1
  13. data/app/controllers/concerns/foreman/controller/parameters/job_template.rb +4 -4
  14. data/app/controllers/job_invocations_controller.rb +10 -6
  15. data/app/controllers/job_templates_controller.rb +1 -1
  16. data/app/controllers/remote_execution_features_controller.rb +3 -2
  17. data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +16 -5
  18. data/app/helpers/job_invocations_chart_helper.rb +11 -10
  19. data/app/helpers/job_invocations_helper.rb +13 -5
  20. data/app/helpers/remote_execution_helper.rb +43 -46
  21. data/app/lib/actions/remote_execution/run_host_job.rb +5 -6
  22. data/app/lib/actions/remote_execution/run_hosts_job.rb +2 -2
  23. data/app/lib/foreman_remote_execution/renderer/scope/input.rb +1 -0
  24. data/app/models/concerns/foreman_remote_execution/errors_flattener.rb +0 -2
  25. data/app/models/concerns/foreman_remote_execution/host_extensions.rb +3 -5
  26. data/app/models/concerns/foreman_remote_execution/nic_extensions.rb +1 -0
  27. data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +1 -0
  28. data/app/models/foreign_input_set.rb +3 -2
  29. data/app/models/input_template_renderer.rb +1 -1
  30. data/app/models/job_invocation.rb +10 -12
  31. data/app/models/job_invocation_composer.rb +20 -14
  32. data/app/models/job_invocation_task_group.rb +1 -1
  33. data/app/models/job_template.rb +3 -3
  34. data/app/models/remote_execution_feature.rb +0 -2
  35. data/app/models/remote_execution_provider.rb +4 -2
  36. data/app/models/setting/remote_execution.rb +54 -56
  37. data/app/models/ssh_execution_provider.rb +2 -2
  38. data/app/models/targeting.rb +1 -0
  39. data/app/models/template_invocation.rb +2 -3
  40. data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
  41. data/app/views/api/v2/job_invocations/main.json.rabl +5 -2
  42. data/app/views/job_invocations/_card_target_hosts.html.erb +12 -0
  43. data/app/views/job_invocations/_card_user_input.html.erb +1 -1
  44. data/app/views/job_invocations/_form.html.erb +3 -2
  45. data/app/views/job_invocations/_rerun_taxonomies.html.erb +22 -0
  46. data/app/views/job_invocations/_user_input.html.erb +1 -1
  47. data/app/views/job_invocations/show.html.erb +2 -0
  48. data/db/migrate/20151215114631_add_host_id_to_template_invocation.rb +1 -0
  49. data/db/migrate/20180110104432_rename_template_invocation_permission.rb +1 -0
  50. data/db/seeds.d/50-notification_blueprints.rb +4 -4
  51. data/db/seeds.d/90-bookmarks.rb +1 -0
  52. data/extra/cockpit/foreman-cockpit-session +7 -2
  53. data/lib/foreman_remote_execution/engine.rb +18 -17
  54. data/lib/foreman_remote_execution/version.rb +1 -1
  55. data/test/benchmark/run_hosts_job_benchmark.rb +1 -1
  56. data/test/factories/foreman_remote_execution_factories.rb +1 -1
  57. data/test/functional/api/v2/job_invocations_controller_test.rb +9 -9
  58. data/test/functional/api/v2/job_templates_controller_test.rb +1 -1
  59. data/test/functional/api/v2/remote_execution_features_controller_test.rb +2 -2
  60. data/test/functional/api/v2/template_invocations_controller_test.rb +4 -4
  61. data/test/functional/job_invocations_controller_test.rb +11 -11
  62. data/test/functional/job_templates_controller_test.rb +1 -1
  63. data/test/unit/actions/run_hosts_job_test.rb +8 -8
  64. data/test/unit/concerns/foreman_tasks_cleaner_extensions_test.rb +3 -3
  65. data/test/unit/concerns/host_extensions_test.rb +19 -19
  66. data/test/unit/concerns/nic_extensions_test.rb +1 -1
  67. data/test/unit/execution_task_status_mapper_test.rb +10 -10
  68. data/test/unit/input_template_renderer_test.rb +77 -77
  69. data/test/unit/job_invocation_composer_test.rb +100 -96
  70. data/test/unit/job_invocation_test.rb +29 -29
  71. data/test/unit/job_template_effective_user_test.rb +3 -3
  72. data/test/unit/job_template_test.rb +31 -31
  73. data/test/unit/remote_execution_feature_test.rb +19 -19
  74. data/test/unit/remote_execution_provider_test.rb +29 -29
  75. data/test/unit/renderer_scope_input.rb +6 -6
  76. data/test/unit/targeting_test.rb +6 -6
  77. data/test/unit/template_invocation_input_value_test.rb +3 -3
  78. metadata +3 -2
@@ -13,15 +13,15 @@ class RendererScopeInputTest < ActiveSupport::TestCase
13
13
  it 'caches the value under given key' do
14
14
  i = 1
15
15
  result = input.cached('some_key') { i }
16
- result.must_equal 1
16
+ _(result).must_equal 1
17
17
 
18
18
  i += 1
19
19
  result = input.cached('some_key') { i }
20
- result.must_equal 1
20
+ _(result).must_equal 1
21
21
 
22
22
  i += 1
23
23
  result = input.cached('different_key') { i }
24
- result.must_equal 3
24
+ _(result).must_equal 3
25
25
  end
26
26
  end
27
27
 
@@ -35,15 +35,15 @@ class RendererScopeInputTest < ActiveSupport::TestCase
35
35
  it 'does not cache the value' do
36
36
  i = 1
37
37
  result = input.cached('some_key') { i }
38
- result.must_equal 1
38
+ _(result).must_equal 1
39
39
 
40
40
  i += 1
41
41
  result = input.cached('some_key') { i }
42
- result.must_equal 2
42
+ _(result).must_equal 2
43
43
 
44
44
  i += 1
45
45
  result = input.cached('different_key') { i }
46
- result.must_equal 3
46
+ _(result).must_equal 3
47
47
  end
48
48
  end
49
49
  end
@@ -51,7 +51,7 @@ class TargetingTest < ActiveSupport::TestCase
51
51
  targeting.resolve_hosts!
52
52
  end
53
53
 
54
- it { targeting.hosts.must_include(host) }
54
+ it { _(targeting.hosts).must_include(host) }
55
55
  end
56
56
 
57
57
  context 'can delete a user' do
@@ -74,7 +74,7 @@ class TargetingTest < ActiveSupport::TestCase
74
74
  host.destroy
75
75
  end
76
76
 
77
- it { targeting.reload.hosts.must_be_empty }
77
+ it { _(targeting.reload.hosts).must_be_empty }
78
78
  end
79
79
 
80
80
  describe '#build_query_from_hosts(ids)' do
@@ -89,9 +89,9 @@ class TargetingTest < ActiveSupport::TestCase
89
89
  let(:query) { Targeting.build_query_from_hosts([ host.id, second_host.id ]) }
90
90
 
91
91
  it 'builds query using host names joining inside ^' do
92
- query.must_include host.name
93
- query.must_include second_host.name
94
- query.must_include 'name ^'
92
+ _(query).must_include host.name
93
+ _(query).must_include second_host.name
94
+ _(query).must_include 'name ^'
95
95
 
96
96
  Host.search_for(query).must_include host
97
97
  Host.search_for(query).must_include second_host
@@ -102,7 +102,7 @@ class TargetingTest < ActiveSupport::TestCase
102
102
  let(:query) { Targeting.build_query_from_hosts([ host.id ]) }
103
103
 
104
104
  it 'builds query using host name' do
105
- query.must_equal "name ^ (#{host.name})"
105
+ _(query).must_equal "name ^ (#{host.name})"
106
106
  Host.search_for(query).must_include host
107
107
  Host.search_for(query).wont_include second_host
108
108
  end
@@ -31,8 +31,8 @@ class TemplateInvocationInputTest < ActiveSupport::TestCase
31
31
  template.template_inputs << FactoryBot.build(:template_input, :name => 'service_name',
32
32
  :input_type => 'user', :required => true)
33
33
  assert_valid FactoryBot.create(:template_invocation_input_value,
34
- :template_invocation => template_invocation,
35
- :template_input => template.template_inputs.first,
36
- :value => 'foreman' * 1_000_000)
34
+ :template_invocation => template_invocation,
35
+ :template_input => template.template_inputs.first,
36
+ :value => 'foreman' * 1_000_000)
37
37
  end
38
38
  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: 3.0.3
4
+ version: 3.1.0
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: 2020-01-22 00:00:00.000000000 Z
11
+ date: 2020-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -242,6 +242,7 @@ files:
242
242
  - app/views/job_invocations/_host_status_td.html.erb
243
243
  - app/views/job_invocations/_preview_hosts_list.html.erb
244
244
  - app/views/job_invocations/_preview_hosts_modal.html.erb
245
+ - app/views/job_invocations/_rerun_taxonomies.html.erb
245
246
  - app/views/job_invocations/_tab_hosts.html.erb
246
247
  - app/views/job_invocations/_tab_overview.html.erb
247
248
  - app/views/job_invocations/_tab_preview_templates.html.erb