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
@@ -32,7 +32,7 @@ class SSHExecutionProvider < RemoteExecutionProvider
32
32
  {
33
33
  :ssh_password => ssh_password(host),
34
34
  :key_passphrase => ssh_key_passphrase(host),
35
- :sudo_password => sudo_password(host)
35
+ :sudo_password => sudo_password(host),
36
36
  }
37
37
  end
38
38
 
@@ -45,7 +45,7 @@ class SSHExecutionProvider < RemoteExecutionProvider
45
45
  :ssh_user => ssh_user(host),
46
46
  :ssh_port => ssh_port(host),
47
47
  :ssh_password => ssh_password(host),
48
- :ssh_key_passphrase => ssh_key_passphrase(host)
48
+ :ssh_key_passphrase => ssh_key_passphrase(host),
49
49
  }
50
50
  end
51
51
 
@@ -61,6 +61,7 @@ class Targeting < ApplicationRecord
61
61
 
62
62
  def self.build_query_from_hosts(ids)
63
63
  return '' if ids.empty?
64
+
64
65
  hosts = Host.where(:id => ids).distinct.pluck(:name)
65
66
  "name ^ (#{hosts.join(', ')})"
66
67
  end
@@ -31,13 +31,12 @@ class TemplateInvocation < ApplicationRecord
31
31
  :error => :failed,
32
32
  :pending => :pending,
33
33
  :success => :success,
34
- :warning => :failed
34
+ :warning => :failed,
35
35
  }.with_indifferent_access
36
36
 
37
- REVERSE_MAP = MAP.reduce({}) do |acc, (key, value)|
37
+ REVERSE_MAP = MAP.each_with_object({}) do |(key, value), acc|
38
38
  acc[value] ||= []
39
39
  acc[value] << key
40
- acc
41
40
  end.with_indifferent_access
42
41
 
43
42
  class << self
@@ -7,7 +7,7 @@ node do |invocation|
7
7
  :succeeded => invocation_count(invocation, :output_key => :success_count),
8
8
  :failed => invocation_count(invocation, :output_key => :failed_count),
9
9
  :pending => invocation_count(invocation, :output_key => :pending_count),
10
- :total => invocation_count(invocation, :output_key => :total_count)
10
+ :total => invocation_count(invocation, :output_key => :total_count),
11
11
  }
12
12
  end
13
13
 
@@ -17,7 +17,7 @@ end
17
17
 
18
18
  child :targeting do
19
19
  attributes :bookmark_id, :search_query, :targeting_type, :user_id, :status, :status_label,
20
- :randomized_ordering
20
+ :randomized_ordering
21
21
 
22
22
  child :hosts do
23
23
  extends 'api/v2/hosts/base'
@@ -31,6 +31,9 @@ end
31
31
  child :template_invocations do
32
32
  attributes :template_id, :template_name
33
33
  child :input_values do
34
- attributes :template_input_name, :template_input_id, :value
34
+ attributes :template_input_name, :template_input_id
35
+ node :value do |iv|
36
+ iv.template_input.respond_to?(:hidden_value) && iv.template_input.hidden_value? ? '*' * 5 : iv.value
37
+ end
35
38
  end
36
39
  end
@@ -20,6 +20,18 @@
20
20
  <% key = job_invocation.targeting.randomized_ordering ? Targeting::RANDOMIZED : Targeting::ORDERED %>
21
21
  <%= _('Execution order') %>: <strong><%= Targeting::ORDERINGS[key].downcase %></strong>
22
22
  </p>
23
+ <p>
24
+ <%= _('Organization') %>:
25
+ <strong>
26
+ <%= show_job_organization(@job_organization) %>
27
+ </strong>
28
+ </p>
29
+ <p>
30
+ <%= _('Location') %>:
31
+ <strong>
32
+ <%= show_job_location(@job_location) %>
33
+ </strong>
34
+ </p>
23
35
  </div>
24
36
  <div class='card-pf-footer'>
25
37
  <p>
@@ -8,7 +8,7 @@
8
8
  <p>
9
9
  <ul>
10
10
  <% template_invocation.input_values.joins(:template_input).each do |input_value| %>
11
- <li><b><%= input_value.template_input.name %></b>: <%= trunc_with_tooltip(input_value.value, 255) %></li>
11
+ <li><b><%= input_value.template_input.name %></b>: <%= input_value.template_input.hidden_value ? '*' * 5 : trunc_with_tooltip(input_value.value, 255) %></li>
12
12
  <% end %>
13
13
  </ul>
14
14
  </p>
@@ -99,8 +99,8 @@
99
99
  </div>
100
100
 
101
101
  <div class="advanced hidden">
102
- <%= number_f f, :concurrency_level, :label => _('Concurrency level'), :placeholder => 'N', :min => 1, :label_help => N_("Run at most N tasks at a time") %>
103
- <%= number_f f, :time_span, :label => _('Time span'), :placeholder => 'N', :min => 1, :label_help => N_("Distribute execution over N seconds") %>
102
+ <%= number_f f, :concurrency_level, :label => _('Concurrency level'), :placeholder => 'N', :min => 1, :label_help => N_("Run at most N tasks at a time. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1.") %>
103
+ <%= number_f f, :time_span, :label => _('Time span'), :placeholder => 'N', :min => 1, :label_help => N_("Distribute execution over N seconds. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1.") %>
104
104
  </div>
105
105
 
106
106
  <div class="form-group advanced hidden">
@@ -126,5 +126,6 @@
126
126
 
127
127
  <%= render :partial => 'preview_hosts_modal' %>
128
128
 
129
+ <%= render partial: 'rerun_taxonomies' if action_name == 'rerun' %>
129
130
  <%= submit_or_cancel f, false, :cancel_path => job_invocations_path, :disabled => !@composer.rerun_possible? %>
130
131
  <% end %>
@@ -0,0 +1,22 @@
1
+ <% if Organization.current != @job_organization %>
2
+ <div class="form-group">
3
+ <div class="col-md-6">
4
+ <div class="alert alert-warning">
5
+ <span class="pficon pficon-warning-triangle-o"></span>
6
+ <%= _("Current organization %{org_c} is different from job's organization %{org_j}.") % { org_c: show_job_organization(Organization.current),
7
+ org_j: show_job_organization(@job_organization) } %>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ <% end %>
12
+ <% if Location.current != @job_location %>
13
+ <div class="form-group">
14
+ <div class="col-md-6">
15
+ <div class="alert alert-warning">
16
+ <span class="pficon pficon-warning-triangle-o"></span>
17
+ <%= _("Current location %{loc_c} is different from job's location %{loc_j}.") % { loc_c: show_job_location(Location.current),
18
+ loc_j: show_job_location(@job_location) } %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <% end %>
@@ -12,7 +12,7 @@
12
12
  <% template_invocation.input_values.joins(:template_input).each do |input_value| %>
13
13
  <tr>
14
14
  <td><b><%= input_value.template_input.name %></b></td>
15
- <td><%= input_value.value %></td>
15
+ <td><%= input_value.template_input.hidden_value? ? '*' * 5 : input_value.value %></td>
16
16
  </tr>
17
17
  <% end %>
18
18
  </tbody>
@@ -19,6 +19,7 @@
19
19
  <% if @job_invocation.recurring_logic.present? %>
20
20
  <li><a href="#recurring_logic" data-toggle="tab"><%= _('Recurring logic') %></a></li>
21
21
  <% end %>
22
+ <%= render_tab_header_for(:main_tabs, subject: @job_invocation) %>
22
23
  </ul>
23
24
 
24
25
  <div class="tab-content">
@@ -38,6 +39,7 @@
38
39
  </div>
39
40
  </div>
40
41
  <% end %>
42
+ <%= render_tab_content_for(:main_tabs, subject: @job_invocation) %>
41
43
  </div>
42
44
 
43
45
  <script id="job_invocation_refresh" data-refresh-url="<%= job_invocation_path(@job_invocation) %>">
@@ -15,6 +15,7 @@ class AddHostIdToTemplateInvocation < ActiveRecord::Migration[4.2]
15
15
  :'foreman_tasks_locks.resource_id' => template_invocation.id
16
16
  ).first
17
17
  next if task.nil? # skip invocations from very early versions of remote executions
18
+
18
19
  host_id = task.locks.where(:'foreman_tasks_locks.resource_type' => 'Host::Managed').first.resource_id
19
20
  next unless Host.find_by(id: host_id)
20
21
 
@@ -14,6 +14,7 @@ class RenameTemplateInvocationPermission < ActiveRecord::Migration[4.2]
14
14
  def switch_filtering_permission!(old, new)
15
15
  old_permission = Permission.find_by(:name => old)
16
16
  return if old_permission.nil?
17
+
17
18
  new_permission = Permission.find_or_create_by(:name => new,
18
19
  :resource_type => 'TemplateInvocation')
19
20
  old_permission.filterings.each do |filtering|
@@ -9,10 +9,10 @@ blueprints = [
9
9
  links:
10
10
  [
11
11
  path_method: :job_invocation_path,
12
- title: N_('Job Details')
13
- ]
14
- }
15
- }
12
+ title: N_('Job Details'),
13
+ ],
14
+ },
15
+ },
16
16
  ]
17
17
 
18
18
  blueprints.each { |blueprint| UINotifications::Seed.new(blueprint).configure }
@@ -10,6 +10,7 @@ Bookmark.without_auditing do
10
10
  next if Bookmark.where(:controller => 'job_invocations').find_by(name: input[:name])
11
11
  # TODO audit should be fixed once core #13109 gets merged
12
12
  next if SeedHelper.audit_modified? Bookmark, input[:name]
13
+
13
14
  attributes = { :public => true }.merge(input)
14
15
  b = Bookmark.where(:name => input[:name], :controller => input[:controller]).first || Bookmark.new
15
16
  b.attributes = attributes
@@ -44,9 +44,11 @@ end
44
44
  def read_control
45
45
  size = $stdin.readline.chomp.to_i
46
46
  raise ArgumentError, "Invalid frame: invalid size" if size.zero?
47
+
47
48
  data = $stdin.read(size)
48
49
  LOG.debug("Received control message #{data.lstrip}")
49
50
  raise ArgumentError, "Invalid frame: too short" if data.nil? || data.length < size
51
+
50
52
  JSON.parse(data)
51
53
  end
52
54
 
@@ -67,6 +69,7 @@ def read_auth_reply
67
69
  cmd = read_control
68
70
  response = cmd["response"]
69
71
  raise ArgumentError, "Did not receive a valid authorize command" if cmd["command"] != "authorize" || !response
72
+
70
73
  response
71
74
  end
72
75
 
@@ -112,8 +115,8 @@ def foreman_call(path, token)
112
115
  return JSON.parse(res.body)
113
116
  when "401"
114
117
  exit_with_problem("authentication-failed",
115
- "Token was not valid",
116
- { "password" => "not-tried", "token" => "denied" })
118
+ "Token was not valid",
119
+ { "password" => "not-tried", "token" => "denied" })
117
120
  when "404"
118
121
  return nil
119
122
  else
@@ -135,6 +138,7 @@ def ssh_read_and_handle_response_header(sock, url, params)
135
138
  loop do
136
139
  line = sock.readline
137
140
  break unless line && (line != "\r\n")
141
+
138
142
  header += line
139
143
  end
140
144
 
@@ -262,6 +266,7 @@ def ssh_with_proxy(proxy, params)
262
266
  end
263
267
 
264
268
  next unless w.include?($stdout)
269
+
265
270
  n = $stdout.write(out_buf)
266
271
  $stdout.flush
267
272
  out_buf = out_buf[n..-1]
@@ -78,7 +78,7 @@ module ForemanRemoteExecution
78
78
  permission :cancel_job_invocations, { :job_invocations => [:cancel], 'api/v2/job_invocations' => [:cancel] }, :resource_type => 'JobInvocation'
79
79
  # this permissions grants user to get auto completion hints when setting up filters
80
80
  permission :filter_autocompletion_for_template_invocation, { :template_invocations => [ :auto_complete_search, :index ] },
81
- :resource_type => 'TemplateInvocation'
81
+ :resource_type => 'TemplateInvocation'
82
82
  permission :cockpit_hosts, { 'cockpit' => [:redirect, :host_ssh_params] }, :resource_type => 'Host'
83
83
  end
84
84
 
@@ -88,7 +88,7 @@ module ForemanRemoteExecution
88
88
  :create_job_invocations,
89
89
  :create_template_invocations,
90
90
  :view_hosts,
91
- :view_smart_proxies
91
+ :view_smart_proxies,
92
92
  ].freeze
93
93
  MANAGER_PERMISSIONS = USER_PERMISSIONS + [
94
94
  :cancel_job_invocations,
@@ -98,32 +98,32 @@ module ForemanRemoteExecution
98
98
  :lock_job_templates,
99
99
  :view_audit_logs,
100
100
  :filter_autocompletion_for_template_invocation,
101
- :edit_remote_execution_features
101
+ :edit_remote_execution_features,
102
102
  ]
103
103
 
104
104
  # Add a new role called 'Remote Execution User ' if it doesn't exist
105
- role 'Remote Execution User', USER_PERMISSIONS
106
- role 'Remote Execution Manager', MANAGER_PERMISSIONS
105
+ role 'Remote Execution User', USER_PERMISSIONS, 'Role with permissions to run remote execution jobs against hosts'
106
+ role 'Remote Execution Manager', MANAGER_PERMISSIONS, 'Role with permissions to manage job templates, remote execution features, cancel jobs and view audit logs'
107
107
 
108
108
  add_all_permissions_to_default_roles
109
109
 
110
110
  # add menu entry
111
111
  menu :top_menu, :job_templates,
112
- url_hash: { controller: :job_templates, action: :index },
113
- caption: N_('Job templates'),
114
- parent: :hosts_menu,
115
- after: :provisioning_templates
112
+ url_hash: { controller: :job_templates, action: :index },
113
+ caption: N_('Job templates'),
114
+ parent: :hosts_menu,
115
+ after: :provisioning_templates
116
116
  menu :admin_menu, :remote_execution_features,
117
- url_hash: { controller: :remote_execution_features, action: :index },
118
- caption: N_('Remote Execution Features'),
119
- parent: :administer_menu,
120
- after: :bookmarks
117
+ url_hash: { controller: :remote_execution_features, action: :index },
118
+ caption: N_('Remote Execution Features'),
119
+ parent: :administer_menu,
120
+ after: :bookmarks
121
121
 
122
122
  menu :top_menu, :job_invocations,
123
- url_hash: { controller: :job_invocations, action: :index },
124
- caption: N_('Jobs'),
125
- parent: :monitor_menu,
126
- after: :audits
123
+ url_hash: { controller: :job_invocations, action: :index },
124
+ caption: N_('Jobs'),
125
+ parent: :monitor_menu,
126
+ after: :audits
127
127
 
128
128
  register_custom_status HostStatus::ExecutionStatus
129
129
  # add dashboard widget
@@ -135,6 +135,7 @@ module ForemanRemoteExecution
135
135
  end
136
136
 
137
137
  extend_rabl_template 'api/v2/smart_proxies/main', 'api/v2/smart_proxies/pubkey'
138
+ describe_host { overview_buttons_provider :host_overview_buttons }
138
139
  end
139
140
  end
140
141
 
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '3.0.3'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
@@ -37,7 +37,7 @@ class ActionTester
37
37
 
38
38
  def run_action(*args)
39
39
  action = create_action(Actions::RemoteExecution::RunHostsJob)
40
- @task.update_attributes(:external_id => action.execution_plan_id)
40
+ @task.update(:external_id => action.execution_plan_id)
41
41
  plan_action(action, *args)
42
42
  end
43
43
  end
@@ -128,7 +128,7 @@ FactoryBot.modify do
128
128
  domain
129
129
  subnet do
130
130
  overrides = {
131
- :remote_execution_proxies => [FactoryBot.create(:smart_proxy, :ssh)]
131
+ :remote_execution_proxies => [FactoryBot.create(:smart_proxy, :ssh)],
132
132
  }
133
133
 
134
134
  overrides[:locations] = [location] unless location.nil?
@@ -78,9 +78,9 @@ module Api
78
78
  context 'with_feature' do
79
79
  setup do
80
80
  @feature = FactoryBot.create(:remote_execution_feature,
81
- :job_template => @template)
81
+ :job_template => @template)
82
82
  @attrs = {
83
- feature: @feature.label
83
+ feature: @feature.label,
84
84
  }
85
85
  end
86
86
 
@@ -171,7 +171,7 @@ module Api
171
171
  assert_equal result['complete'], false
172
172
  assert_equal result['delayed'], true
173
173
  assert_nil result['output']
174
- Time.parse(result['start_at']).to_f.must_be_close_to start_time.to_f
174
+ _(Time.parse(result['start_at']).to_f).must_be_close_to start_time.to_f
175
175
  assert_response :success
176
176
  end
177
177
 
@@ -227,8 +227,8 @@ module Api
227
227
  assert_response :success
228
228
  result = ActiveSupport::JSON.decode(@response.body)
229
229
  targeting = Targeting.find(result['targeting_id'])
230
- targeting.user_id.must_equal users(:admin).id
231
- targeting.search_query.must_equal @invocation.targeting.search_query
230
+ _(targeting.user_id).must_equal users(:admin).id
231
+ _(targeting.search_query).must_equal @invocation.targeting.search_query
232
232
  end
233
233
 
234
234
  test 'should not raise an exception when reruning failed has no hosts' do
@@ -241,8 +241,8 @@ module Api
241
241
  assert_response :success
242
242
  result = ActiveSupport::JSON.decode(@response.body)
243
243
  targeting = Targeting.find(result['targeting_id'])
244
- targeting.user_id.must_equal users(:admin).id
245
- targeting.search_query.must_equal 'name ^ ()'
244
+ _(targeting.user_id).must_equal users(:admin).id
245
+ _(targeting.search_query).must_equal 'name ^ ()'
246
246
  end
247
247
 
248
248
  test 'should rerun failed only' do
@@ -260,8 +260,8 @@ module Api
260
260
  result = ActiveSupport::JSON.decode(@response.body)
261
261
  targeting = Targeting.find(result['targeting_id'])
262
262
  hostnames = @invocation.template_invocations.map { |ti| ti.host.name }
263
- targeting.user_id.must_equal users(:admin).id
264
- targeting.search_query.must_equal "name ^ (#{hostnames.join(',')})"
263
+ _(targeting.user_id).must_equal users(:admin).id
264
+ _(targeting.search_query).must_equal "name ^ (#{hostnames.join(',')})"
265
265
  end
266
266
 
267
267
  test 'should return 404 if template is not found' do
@@ -39,7 +39,7 @@ module Api
39
39
  valid_attrs = { :template => 'This is a test template', :name => 'RandomName', :provider_type => 'ssh' }
40
40
  post :create, params: { :job_template => valid_attrs }
41
41
  template = ActiveSupport::JSON.decode(@response.body)
42
- assert template['name'] == 'RandomName'
42
+ assert_equal template['name'], 'RandomName'
43
43
  assert_response :success
44
44
  end
45
45
 
@@ -5,8 +5,8 @@ module Api
5
5
  class RemoteExecutionFeaturesControllerTest < ActionController::TestCase
6
6
  setup do
7
7
  @remote_execution_feature = RemoteExecutionFeature.register(:my_awesome_feature, 'My awesome feature',
8
- :description => 'You will not believe what it does',
9
- :provided_inputs => ['awesomeness_level'])
8
+ :description => 'You will not believe what it does',
9
+ :provided_inputs => ['awesomeness_level'])
10
10
  @template = FactoryBot.create(:job_template, :with_input)
11
11
  end
12
12
 
@@ -13,8 +13,8 @@ module Api
13
13
  test 'should get template invocations belonging to job invocation' do
14
14
  get :template_invocations, params: { :id => @job.id }
15
15
  invocations = ActiveSupport::JSON.decode(@response.body)
16
- invocations['results'].count.must_equal @job.template_invocations.count
17
- invocations['total'].must_equal @job.template_invocations.count
16
+ _(invocations['results'].count).must_equal @job.template_invocations.count
17
+ _(invocations['total']).must_equal @job.template_invocations.count
18
18
 
19
19
  expected_result = {
20
20
  'id' => @template_invocation.id,
@@ -23,9 +23,9 @@ module Api
23
23
  'template_id' => @template_invocation.template_id,
24
24
  'effective_user' => @template_invocation.effective_user,
25
25
  'job_invocation_id' => @job.id,
26
- 'run_host_job_task_id' => @template_invocation.run_host_job_task_id
26
+ 'run_host_job_task_id' => @template_invocation.run_host_job_task_id,
27
27
  }
28
- invocations['results'].must_equal [expected_result]
28
+ _(invocations['results']).must_equal [expected_result]
29
29
  assert_response :success
30
30
  end
31
31
  end