foreman_remote_execution 5.0.1 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/app/lib/actions/remote_execution/run_host_job.rb +2 -0
- data/app/lib/foreman_remote_execution/renderer/scope/input.rb +1 -1
- data/app/models/job_invocation.rb +2 -0
- data/app/models/job_template.rb +3 -1
- data/app/views/job_templates/_custom_tabs.html.erb +4 -9
- data/app/views/template_invocations/show.html.erb +7 -1
- data/lib/foreman_remote_execution/engine.rb +1 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/test/unit/job_invocation_report_template_test.rb +1 -1
- data/test/unit/targeting_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 831ec5aca2ec4aaa3df1229f7addd9a968c7c49b0fc49a15253e33d2ab0f5689
|
4
|
+
data.tar.gz: 07a4f17f0d4d694c4b927291ee8e55dafd839cf902a9ef06c79b227fdf65760f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75fd11cfe45b5223a2427561c0859c39f19923535283fa919927af9b4ffd67ea56a4c9b791632e73c72c4dff1946f2e1046cb10a1f84ed7dae0e686daff2d90d
|
7
|
+
data.tar.gz: 03557c309e25a902c0def6e7575ad74a02e724482da823b4580f4bbe9b80358eadb2e0781b832f45a2e9101196447edf887476fa79782a3d6ee125640dccd92a
|
data/Gemfile
CHANGED
@@ -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)
|
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
|
data/app/models/job_template.rb
CHANGED
@@ -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.
|
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
|
-
<%=
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
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: '
|
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
|
@@ -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/
|
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
|
data/test/unit/targeting_test.rb
CHANGED
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
|
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-
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|