foreman_remote_execution 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd91f2539393453fe888022502baba8ad7597da50682a4d87a8cf78dcaaebbfa
4
- data.tar.gz: 2c97670fa1b3555f9660ea8adee03e48ae83779aff3324d977eae65a70b86956
3
+ metadata.gz: 831ec5aca2ec4aaa3df1229f7addd9a968c7c49b0fc49a15253e33d2ab0f5689
4
+ data.tar.gz: 07a4f17f0d4d694c4b927291ee8e55dafd839cf902a9ef06c79b227fdf65760f
5
5
  SHA512:
6
- metadata.gz: 7fbc26b3be07128f7dd015db03b8e46d34faee8f13f8b7e7f3d6ff54f360afd70cdd6f4143862695342591be55cfed9a74f315ae77ef5231cd20bee5f9bf8565
7
- data.tar.gz: 851d5fd53efb928e8a6ce15468af83bc992b98265bc289f23fed310834e1c83753113e981a673f89e3183efaa7d6f76ec270f06f1f41072f79c045947a78b6c8
6
+ metadata.gz: 75fd11cfe45b5223a2427561c0859c39f19923535283fa919927af9b4ffd67ea56a4c9b791632e73c72c4dff1946f2e1046cb10a1f84ed7dae0e686daff2d90d
7
+ data.tar.gz: 03557c309e25a902c0def6e7575ad74a02e724482da823b4580f4bbe9b80358eadb2e0781b832f45a2e9101196447edf887476fa79782a3d6ee125640dccd92a
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec :name => 'foreman_remote_execution'
4
4
 
5
- gem 'theforeman-rubocop', '~> 0.1.0.pre'
5
+ gem 'theforeman-rubocop', '~> 0.1.1'
@@ -42,6 +42,8 @@ module Actions
42
42
 
43
43
  provider_type = template_invocation.template.provider_type.to_s
44
44
  proxy = determine_proxy!(proxy_selector, provider_type, host)
45
+ link!(proxy)
46
+ input[:proxy_id] = proxy.id
45
47
 
46
48
  renderer = InputTemplateRenderer.new(template_invocation.template, host, template_invocation)
47
49
  script = renderer.render
@@ -98,7 +98,7 @@ module ForemanRemoteExecution
98
98
  def input(name)
99
99
  return template_input_values[name.to_s] if template_input_values.key?(name.to_s)
100
100
 
101
- input = find_by_name(template.template_inputs_with_foreign, name) # rubocop:disable Rails/DynamicFindBy
101
+ input = find_by_name(template.template_inputs_with_foreign, name)
102
102
  if input
103
103
  @preview ? input.preview(self) : input.value(self)
104
104
  else
@@ -15,8 +15,10 @@ class JobInvocation < ApplicationRecord
15
15
 
16
16
  belongs_to :targeting, :dependent => :destroy
17
17
  has_many :all_template_invocations, :inverse_of => :job_invocation, :dependent => :destroy, :class_name => 'TemplateInvocation'
18
+ # rubocop:disable Rails/HasManyOrHasOneDependent
18
19
  has_many :template_invocations, -> { where('template_invocations.host_id IS NOT NULL') }, :inverse_of => :job_invocation
19
20
  has_many :pattern_template_invocations, -> { where('template_invocations.host_id IS NULL') }, :inverse_of => :job_invocation, :class_name => 'TemplateInvocation'
21
+ # rubocop:enable Rails/HasManyOrHasOneDependent
20
22
  has_many :pattern_templates, :through => :pattern_template_invocations, :source => :template
21
23
 
22
24
  validates :targeting, :presence => true
@@ -17,8 +17,10 @@ class JobTemplate < ::Template
17
17
 
18
18
  has_many :audits, :as => :auditable, :class_name => Audited.audit_class.name, :dependent => :nullify
19
19
  has_many :all_template_invocations, :dependent => :destroy, :foreign_key => 'template_id', :class_name => 'TemplateInvocation'
20
+ # rubocop:disable Rails/HasManyOrHasOneDependent
20
21
  has_many :template_invocations, -> { where('host_id IS NOT NULL') }, :foreign_key => 'template_id'
21
22
  has_many :pattern_template_invocations, -> { where('host_id IS NULL') }, :foreign_key => 'template_id', :class_name => 'TemplateInvocation'
23
+ # rubocop:enable Rails/HasManyOrHasOneDependent
22
24
  has_many :remote_execution_features, :dependent => :nullify
23
25
 
24
26
  # these can't be shared in parent class, scoped search can't handle STI properly
@@ -192,7 +194,7 @@ class JobTemplate < ::Template
192
194
  end
193
195
 
194
196
  def default_input_values(ignore_keys)
195
- result = self.template_inputs_with_foreign.select { |ti| !ti.required? && ti.user_template_input? }.map { |ti| ti.name.to_s }
197
+ result = self.template_inputs_with_foreign.select { |ti| !ti.required? && ti.input_type == 'user' }.map { |ti| ti.name.to_s }
196
198
  result -= ignore_keys.map(&:to_s)
197
199
  Hash[result.map { |k| [ k, nil ] }]
198
200
  end
@@ -1,14 +1,9 @@
1
1
  <div class="tab-pane" id="template_job">
2
2
 
3
- <%= field(f, :job_category, :label => _('Job category')) do %>
4
- <%= auto_complete_search(:job_category,
5
- f.object.job_category,
6
- :placeholder => _("Job category") + ' ...',
7
- :name => 'job_template[job_category]',
8
- :id => 'search',
9
- :disabled => @template.locked?) %>
10
- <% end %>
11
-
3
+ <%= autocomplete_f(f, :job_category,
4
+ :search_query => '',
5
+ :placeholder => _("Job category") + ' ...',
6
+ :disabled => @template.locked?) %>
12
7
  <%= text_f f, :description_format,
13
8
  :disabled => @template.locked?,
14
9
  :label_help => description_format_help %>
@@ -28,7 +28,13 @@ end
28
28
  </div>
29
29
  </div>
30
30
  <% if @host %>
31
- <h3><%= _('Target: ') %><%= link_to(@host.name, host_path(@host)) %></h3>
31
+ <% proxy_id = @template_invocation_task.input[:proxy_id] %>
32
+ <h3>
33
+ <%= _('Target: ') %><%= link_to(@host.name, host_path(@host)) %>
34
+ <% if proxy_id && proxy = SmartProxy.find_by(id: proxy_id) %>
35
+ <%= _('using Smart Proxy') %> <%= link_to(proxy.name, smart_proxy_path(proxy)) %>
36
+ <% end %>
37
+ </h3>
32
38
 
33
39
  <div class="preview hidden">
34
40
  <%= preview_box(@template_invocation, @host) %>
@@ -152,7 +152,7 @@ module ForemanRemoteExecution
152
152
  setting 'remote_execution_job_invocation_report_template',
153
153
  type: :string,
154
154
  description: N_('Select a report template used for generating a report for a particular remote execution job'),
155
- default: 'Jobs - Invocation report template',
155
+ default: 'Job invocation - report template',
156
156
  full_name: N_('Job Invocation Report Template'),
157
157
  collection: proc { ForemanRemoteExecution.job_invocation_report_templates_select }
158
158
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '5.0.1'.freeze
2
+ VERSION = '5.1.0'.freeze
3
3
  end
@@ -9,7 +9,7 @@ class JobReportTemplateTest < ActiveSupport::TestCase
9
9
 
10
10
  context 'with valid job invocation report template' do
11
11
  let(:job_invocation_template) do
12
- file_path = File.read(File.expand_path(Rails.root + "app/views/unattended/report_templates/jobs_-_invocation_report_template.erb"))
12
+ file_path = File.read(File.expand_path(Rails.root + "app/views/unattended/report_templates/job_invocation_-_report_template.erb"))
13
13
  template = ReportTemplate.import_without_save("Job Invocation Report Template", file_path)
14
14
  template.save!
15
15
  template
@@ -61,7 +61,7 @@ class TargetingTest < ActiveSupport::TestCase
61
61
  users(:one).destroy
62
62
  end
63
63
 
64
- it { assert targeting.reload.user.nil? }
64
+ it { assert_nil targeting.reload.user }
65
65
  it do
66
66
  -> { targeting.resolve_hosts! }.must_raise(Foreman::Exception)
67
67
  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: 5.0.1
4
+ version: 5.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: 2021-12-03 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface