foreman_remote_execution 18.1.0 → 18.1.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3c23f64526a7b6f79395e27c086b46ccf04bfc536a8e1625546fea767968225
|
|
4
|
+
data.tar.gz: '028bcf911b5587b74314729e739594b844278fc2067ba1bff06383f51d5d40fc'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e740838ca9564390444e487bbd819095ff3d0ef8b02529ece59e135475a6ca1542e986df686483403a016e4a7227a1634fd60cd51f887ff44688358228a06d1
|
|
7
|
+
data.tar.gz: f6b2b5b5f44b0a0ab5408d28b6dd66228473d30a187ca94811903ae6cf95dadfde599dd92a0fc09617d7a541aa904dfde2f23f96acbb61f3eaa6e1da746ea6d1
|
|
@@ -66,7 +66,7 @@ class JobInvocationsController < ApplicationController
|
|
|
66
66
|
|
|
67
67
|
job_invocations = job_invocations.map do |job|
|
|
68
68
|
@job_invocation = job
|
|
69
|
-
template_invocation = job.template_invocations.
|
|
69
|
+
template_invocation = job.template_invocations.find_by(:host_id => params[:host_id].to_i)
|
|
70
70
|
task = template_invocation.try(:run_host_job_task)
|
|
71
71
|
status_mapper = task ? HostStatus::ExecutionStatus::ExecutionTaskStatusMapper.new(task) : job
|
|
72
72
|
{
|
|
@@ -24,7 +24,7 @@ class TemplateInvocationsController < ApplicationController
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def show_template_invocation_by_host
|
|
27
|
-
@template_invocation = @job_invocation.template_invocations.
|
|
27
|
+
@template_invocation = @job_invocation.template_invocations.find_by(host_id: @host.id)
|
|
28
28
|
if @template_invocation.nil?
|
|
29
29
|
render :json => { :error => _('Template invocation not found') }, :status => :not_found
|
|
30
30
|
end
|
|
@@ -60,13 +60,15 @@ class TemplateInvocationsController < ApplicationController
|
|
|
60
60
|
private
|
|
61
61
|
|
|
62
62
|
def find_job_invocation
|
|
63
|
-
@job_invocation = JobInvocation.
|
|
63
|
+
@job_invocation = JobInvocation.authorized(:view_job_invocations)
|
|
64
|
+
.joins(:template_invocations)
|
|
65
|
+
.find_by!(id: params[:id], template_invocations: { host_id: params[:host_id] })
|
|
64
66
|
rescue ActiveRecord::RecordNotFound
|
|
65
67
|
render :json => { :error => { :message => format(_("Job with id '%{id}' was not found"), :id => params['id']) } }, :status => :not_found
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
def find_host
|
|
69
|
-
@host = Host.find(params[:host_id])
|
|
71
|
+
@host = Host.authorized(:view_hosts, Host).find(params[:host_id])
|
|
70
72
|
rescue ActiveRecord::RecordNotFound
|
|
71
73
|
render :json => { :error => { :message => format(_("Host with id '%{id}' was not found"), :id => params['host_id']) } }, :status => :not_found
|
|
72
74
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_plugin_helper'
|
|
4
|
+
|
|
5
|
+
class TemplateInvocationsControllerTest < ActionController::TestCase
|
|
6
|
+
setup do
|
|
7
|
+
@invocation = FactoryBot.create(:job_invocation, :with_template, :with_task)
|
|
8
|
+
@template_invocation = @invocation.template_invocations.first
|
|
9
|
+
ForemanTasks::Task.any_instance.stubs(:main_action).returns(OpenStruct.new(:live_output => [], :output => {}))
|
|
10
|
+
ForemanTasks::Task.any_instance.stubs(:execution_plan).returns(OpenStruct.new(:actions => [nil, OpenStruct.new(:input => { 'script' => '' })]))
|
|
11
|
+
ForemanTasks::Task.any_instance.stubs(:cancellable?).returns(false)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
test 'should not show template invocation for a job invocation outside the permission filter' do
|
|
15
|
+
user = setup_user 'view', 'hosts'
|
|
16
|
+
setup_user 'view', 'job_invocations', "id != #{@invocation.id}"
|
|
17
|
+
|
|
18
|
+
get :show_template_invocation_by_host,
|
|
19
|
+
params: { id: @invocation.id, host_id: @template_invocation.host_id },
|
|
20
|
+
session: set_session_user(user)
|
|
21
|
+
|
|
22
|
+
assert_response :not_found
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
test 'should not show template invocation for a host outside the permission filter' do
|
|
26
|
+
user = setup_user 'view', 'job_invocations'
|
|
27
|
+
setup_user 'view', 'hosts', "name != #{@template_invocation.host.name}"
|
|
28
|
+
|
|
29
|
+
get :show_template_invocation_by_host,
|
|
30
|
+
params: { id: @invocation.id, host_id: @template_invocation.host_id },
|
|
31
|
+
session: set_session_user(user)
|
|
32
|
+
|
|
33
|
+
assert_response :not_found
|
|
34
|
+
end
|
|
35
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_remote_execution
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 18.1.
|
|
4
|
+
version: 18.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Foreman Remote Execution team
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-11-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: deface
|
|
@@ -331,6 +331,7 @@ files:
|
|
|
331
331
|
- test/functional/cockpit_controller_test.rb
|
|
332
332
|
- test/functional/job_invocations_controller_test.rb
|
|
333
333
|
- test/functional/job_templates_controller_test.rb
|
|
334
|
+
- test/functional/template_invocations_controller_test.rb
|
|
334
335
|
- test/functional/ui_job_wizard_controller_test.rb
|
|
335
336
|
- test/graphql/mutations/job_invocations/create_test.rb
|
|
336
337
|
- test/graphql/queries/job_invocation_query_test.rb
|