foreman_remote_execution 16.6.6 → 16.6.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c70e248f7f1d1a6fb7dd1424915e6982d96ef6d2681564b9d8c83f14207062a
|
|
4
|
+
data.tar.gz: 0df83541a7c217e72e3356b68ea8f8fc8bf597ca36e572d4c56f470bbc8ba986
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a66e078d7b482499e27048cdcd00bbd79da1ed27b4ac43f23904d1fdd09d1f1aa4d37f898e33e05ef1c666ff599e493d356b3502a8cf52798269e5bb25c213e
|
|
7
|
+
data.tar.gz: 11114c1b631fd6f810ec410c2e77c307fb7f1989ac70cf412f05cdf6e63867d2dc7497cbeadd86a13d966fa71a978bb4bae5dbda42c61bce01771c4f6257caef
|
|
@@ -135,7 +135,7 @@ class JobInvocationsController < ApplicationController
|
|
|
135
135
|
|
|
136
136
|
job_invocations = job_invocations.map do |job|
|
|
137
137
|
@job_invocation = job
|
|
138
|
-
template_invocation = job.template_invocations.
|
|
138
|
+
template_invocation = job.template_invocations.find_by(:host_id => params[:host_id].to_i)
|
|
139
139
|
task = template_invocation.try(:run_host_job_task)
|
|
140
140
|
status_mapper = task ? HostStatus::ExecutionStatus::ExecutionTaskStatusMapper.new(task) : job
|
|
141
141
|
{
|
|
@@ -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: 16.6.
|
|
4
|
+
version: 16.6.7
|
|
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
|
|
@@ -355,6 +355,7 @@ files:
|
|
|
355
355
|
- test/functional/cockpit_controller_test.rb
|
|
356
356
|
- test/functional/job_invocations_controller_test.rb
|
|
357
357
|
- test/functional/job_templates_controller_test.rb
|
|
358
|
+
- test/functional/template_invocations_controller_test.rb
|
|
358
359
|
- test/functional/ui_job_wizard_controller_test.rb
|
|
359
360
|
- test/graphql/mutations/job_invocations/create_test.rb
|
|
360
361
|
- test/graphql/queries/job_invocation_query_test.rb
|