foreman_remote_execution 3.3.2 → 3.3.7
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 +4 -4
- data/.github/workflows/ci.yml +1 -0
- data/app/assets/stylesheets/foreman_remote_execution/job_invocations.scss +6 -5
- data/app/controllers/api/v2/job_invocations_controller.rb +3 -2
- data/app/models/concerns/foreman_remote_execution/orchestration/ssh.rb +11 -4
- data/app/services/default_proxy_proxy_selector.rb +3 -1
- data/app/views/api/v2/job_invocations/main.json.rabl +2 -2
- data/app/views/job_invocations/_card_target_hosts.html.erb +1 -1
- data/app/views/job_invocations/index.html.erb +2 -1
- data/app/views/job_invocations/show.html.erb +6 -0
- data/app/views/job_invocations/show.js.erb +5 -0
- data/app/views/templates/ssh/package_action.erb +1 -0
- data/app/views/templates/ssh/puppet_agent_disable.erb +3 -0
- data/app/views/templates/ssh/puppet_agent_enable.erb +3 -0
- data/app/views/templates/ssh/puppet_install_modules_from_forge.erb +3 -0
- data/app/views/templates/ssh/puppet_run_once.erb +3 -0
- data/lib/foreman_remote_execution/engine.rb +9 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/test/functional/api/v2/job_invocations_controller_test.rb +1 -1
- data/test/models/orchestration/ssh_test.rb +1 -1
- data/webpack/react_app/components/TargetingHosts/TargetingHosts.js +1 -1
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c5854e373426c0a630f0a643f88522425c6482fb88fee1888fc6f61114217c3
|
4
|
+
data.tar.gz: f333b2504dc7db6e1119d418c89fcd2cd35d5dcbd72e97d393b57a16c9d305a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3df47233fbc5b7bb2628a2bb49906c284e8e7c821bb8a026659e0473f9bc8760d5ed3c19f27183f5fd32ab39d5b06cdb0e9345a1e9e4a4629a269adb3121370a
|
7
|
+
data.tar.gz: 33d40d8f6449814f23648dbe20c6a376a152135b4a4c5de583a73e1db03ab69ecb39b1a2ce3a1cabad717be898a683f3d58fe5e1aaf50438011f6ce4cfbbe2b4
|
data/.github/workflows/ci.yml
CHANGED
@@ -18,14 +18,14 @@ module Api
|
|
18
18
|
|
19
19
|
api :GET, '/job_invocations/:id', N_('Show job invocation')
|
20
20
|
param :id, :identifier, :required => true
|
21
|
-
param :host_status,
|
21
|
+
param :host_status, :bool, required: false, desc: N_('Show Job status for the hosts')
|
22
22
|
def show
|
23
23
|
@hosts = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)
|
24
24
|
@template_invocations = @job_invocation.template_invocations
|
25
25
|
.where(host: @hosts)
|
26
26
|
.includes(:input_values)
|
27
27
|
|
28
|
-
if params[:host_status]
|
28
|
+
if params[:host_status] == 'true'
|
29
29
|
template_invocations = @template_invocations.includes(:run_host_job_task).to_a
|
30
30
|
@host_statuses = Hash[template_invocations.map { |ti| [ti.host_id, template_invocation_status(ti)] }]
|
31
31
|
end
|
@@ -80,6 +80,7 @@ module Api
|
|
80
80
|
end
|
81
81
|
composer.trigger!
|
82
82
|
@job_invocation = composer.job_invocation
|
83
|
+
@hosts = @job_invocation.targeting.hosts
|
83
84
|
process_response @job_invocation
|
84
85
|
end
|
85
86
|
|
@@ -15,9 +15,13 @@ module ForemanRemoteExecution
|
|
15
15
|
proxy = ::SmartProxy.find(proxy_id)
|
16
16
|
begin
|
17
17
|
proxy.drop_host_from_known_hosts(target)
|
18
|
-
rescue
|
19
|
-
|
20
|
-
|
18
|
+
rescue ::ProxyAPI::ProxyException => e
|
19
|
+
if e.wrapped_exception.is_a?(RestClient::NotFound)
|
20
|
+
# ignore 404 when known_hosts entry is missing or the module was not enabled
|
21
|
+
Foreman::Logging.exception "Proxy failed to delete SSH known_hosts for #{name}, #{ip}", e, :level => :error
|
22
|
+
else
|
23
|
+
raise e
|
24
|
+
end
|
21
25
|
rescue => e
|
22
26
|
Rails.logger.warn e.message
|
23
27
|
return false
|
@@ -29,7 +33,10 @@ module ForemanRemoteExecution
|
|
29
33
|
logger.debug "Scheduling SSH known_hosts cleanup"
|
30
34
|
|
31
35
|
host, _kind, _target = host_kind_target
|
32
|
-
|
36
|
+
# #remote_execution_proxies may not be defined on the host object in some case
|
37
|
+
# for example Host::Discovered does not have it defined, even though these hosts
|
38
|
+
# have Nic::Managed interfaces associated with them
|
39
|
+
proxies = (host.try(:remote_execution_proxies, 'SSH') || {}).values
|
33
40
|
proxies.flatten.uniq.each do |proxy|
|
34
41
|
queue.create(id: queue_id(proxy.id), name: _("Remove SSH known hosts for %s") % self,
|
35
42
|
priority: 200, action: [self, :drop_from_known_hosts, proxy.id])
|
@@ -10,7 +10,9 @@ class DefaultProxyProxySelector < ::RemoteExecutionProxySelector
|
|
10
10
|
def available_proxies(host, provider)
|
11
11
|
# TODO: Once we have a internal proxy marker/feature on the proxy, we can
|
12
12
|
# swap the implementation
|
13
|
-
|
13
|
+
raise _('default_capsule method missing from SmartProxy') unless ::SmartProxy.respond_to?(:default_capsule)
|
14
|
+
|
15
|
+
internal_proxy = ::SmartProxy.default_capsule
|
14
16
|
super.reduce({}) do |acc, (key, proxies)|
|
15
17
|
acc.merge(key => proxies.select { |proxy| proxy == internal_proxy })
|
16
18
|
end
|
@@ -19,10 +19,10 @@ child :targeting do
|
|
19
19
|
attributes :bookmark_id, :search_query, :targeting_type, :user_id, :status, :status_label,
|
20
20
|
:randomized_ordering
|
21
21
|
|
22
|
-
child @hosts do
|
22
|
+
child @hosts => :hosts do
|
23
23
|
extends 'api/v2/hosts/base'
|
24
24
|
|
25
|
-
if params[:host_status]
|
25
|
+
if params[:host_status] == 'true'
|
26
26
|
node :job_status do |host|
|
27
27
|
@host_statuses[host.id]
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% template_invocations = job_invocation.pattern_template_invocations %>
|
2
|
-
<div class="card-pf card-pf-accented">
|
2
|
+
<div class="card-pf card-pf-accented target-hosts-card">
|
3
3
|
<div class="card-pf-title">
|
4
4
|
<h2 style="height: 18px;" class="card-pf-title">
|
5
5
|
<%= _('Target hosts') %>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<% stylesheet 'foreman_remote_execution/foreman_remote_execution' %>
|
1
2
|
<% title _('Job invocations') %>
|
2
3
|
|
3
4
|
<% title_actions(job_invocations_buttons) %>
|
@@ -19,7 +20,7 @@
|
|
19
20
|
<tbody>
|
20
21
|
<% @job_invocations.each do |invocation| %>
|
21
22
|
<tr>
|
22
|
-
<td><%= link_to_if_authorized invocation_description(invocation), hash_for_job_invocation_path(invocation).merge(:auth_object => invocation, :permission => :view_job_invocations, :authorizer => authorizer) %></td>
|
23
|
+
<td class="text_warp"><%= link_to_if_authorized invocation_description(invocation), hash_for_job_invocation_path(invocation).merge(:auth_object => invocation, :permission => :view_job_invocations, :authorizer => authorizer) %></td>
|
23
24
|
<td><%= trunc_with_tooltip(invocation&.targeting&.search_query, 15) %></td>
|
24
25
|
<td><%= link_to_invocation_task_if_authorized(invocation) %></td>
|
25
26
|
<td><%= invocation_result(invocation, :success_count) %></td>
|
@@ -41,3 +41,9 @@
|
|
41
41
|
<% end %>
|
42
42
|
<%= render_tab_content_for(:main_tabs, subject: @job_invocation) %>
|
43
43
|
</div>
|
44
|
+
|
45
|
+
<script id="job_invocation_refresh" data-refresh-url="<%= job_invocation_path(@job_invocation) %>">
|
46
|
+
<% if @auto_refresh %>
|
47
|
+
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), {});
|
48
|
+
<% end %>
|
49
|
+
</script>
|
@@ -97,6 +97,7 @@ handle_zypp_res_codes () {
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
-%>
|
100
|
+
[ -x "$(command -v subscription-manager)" ] && subscription-manager refresh
|
100
101
|
apt-get -y update
|
101
102
|
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y <%= action %> <%= input("package") %>
|
102
103
|
<% elsif package_manager == 'zypper' -%>
|
@@ -13,4 +13,7 @@ template_inputs:
|
|
13
13
|
provider_type: SSH
|
14
14
|
kind: job_template
|
15
15
|
-%>
|
16
|
+
<% if @host.operatingsystem.family == 'Debian' -%>
|
17
|
+
export PATH=/opt/puppetlabs/bin:$PATH
|
18
|
+
<% end -%>
|
16
19
|
puppet agent --disable "<%= input("comment").present? ? input("comment") : "Disabled using Foreman Remote Execution" %> - <%= current_user %> - $(date "+%d/%m/%Y %H:%M")"
|
@@ -33,4 +33,7 @@ template_inputs:
|
|
33
33
|
provider_type: SSH
|
34
34
|
kind: job_template
|
35
35
|
-%>
|
36
|
+
<% if @host.operatingsystem.family == 'Debian' -%>
|
37
|
+
export PATH=/opt/puppetlabs/bin:$PATH
|
38
|
+
<% end -%>
|
36
39
|
puppet module install <%= input('puppet_module') %> <%= "--target-dir #{input('target_dir')}" if input('target_dir').present? %> <%= "--version #{input('version')}" if input('version').present? %> <%= "--force" if input('force') == "true" %> <%= "--ignore-dependencies" if input('ignore_dependencies') == "true" %>
|
@@ -11,4 +11,7 @@ template_inputs:
|
|
11
11
|
input_type: user
|
12
12
|
required: false
|
13
13
|
%>
|
14
|
+
<% if @host.operatingsystem.family == 'Debian' -%>
|
15
|
+
export PATH=/opt/puppetlabs/bin:$PATH
|
16
|
+
<% end -%>
|
14
17
|
puppet agent --onetime --no-usecacheonfailure --no-daemonize <%= input("puppet_options") %>
|
@@ -32,6 +32,15 @@ module ForemanRemoteExecution
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# A workaround for https://projects.theforeman.org/issues/30685
|
36
|
+
initializer 'foreman_remote_execution.rails_loading_workaround' do
|
37
|
+
# Without this, in production environment the module gets prepended too
|
38
|
+
# late and the extensions do not get applied
|
39
|
+
# TODO: Remove this and from config.to_prepare once there is an extension
|
40
|
+
# point in Foreman
|
41
|
+
ProvisioningTemplatesHelper.prepend ForemanRemoteExecution::JobTemplatesExtensions
|
42
|
+
end
|
43
|
+
|
35
44
|
initializer 'foreman_remote_execution.apipie' do
|
36
45
|
Apipie.configuration.checksum_path += ['/api/']
|
37
46
|
end
|
@@ -44,7 +44,7 @@ module Api
|
|
44
44
|
get :show, params: { :id => @invocation.id }, session: set_session_user(@user)
|
45
45
|
assert_response :success
|
46
46
|
response = ActiveSupport::JSON.decode(@response.body)
|
47
|
-
|
47
|
+
assert_equal response['targeting']['hosts'], []
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -30,7 +30,7 @@ class SSHOrchestrationTest < ActiveSupport::TestCase
|
|
30
30
|
|
31
31
|
it 'does not fail on 404 from the smart proxy' do
|
32
32
|
host.stubs(:skip_orchestration?).returns false
|
33
|
-
|
33
|
+
::ProxyAPI::RemoteExecutionSSH.any_instance.expects(:delete).raises(RestClient::ResourceNotFound).twice
|
34
34
|
host.build = true
|
35
35
|
host.save!
|
36
36
|
ids = ["ssh_remove_known_hosts_interface_#{interface.ip}_#{proxy.id}",
|
@@ -17,7 +17,7 @@ const TargetingHosts = ({ status, items }) => {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
return (
|
20
|
-
<LoadingState loading={!items.length}>
|
20
|
+
<LoadingState loading={!items.length && status === STATUS.PENDING}>
|
21
21
|
<div>
|
22
22
|
<table className="table table-bordered table-striped table-hover">
|
23
23
|
<thead>
|
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.3.
|
4
|
+
version: 3.3.7
|
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-
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- app/views/job_invocations/new.html.erb
|
250
250
|
- app/views/job_invocations/refresh.js.erb
|
251
251
|
- app/views/job_invocations/show.html.erb
|
252
|
+
- app/views/job_invocations/show.js.erb
|
252
253
|
- app/views/job_invocations/show.json.erb
|
253
254
|
- app/views/job_invocations/welcome.html.erb
|
254
255
|
- app/views/job_templates/_custom_tab_headers.html.erb
|