foreman_remote_execution 5.0.0 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +20 -9
- data/app/helpers/remote_execution_helper.rb +4 -3
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +4 -0
- data/app/models/targeting.rb +1 -1
- data/app/views/dashboard/_latest-jobs.html.erb +1 -1
- data/app/views/job_invocations/_preview_hosts_list.html.erb +1 -1
- data/app/views/template_invocations/show.html.erb +1 -1
- data/lib/foreman_remote_execution/engine.rb +5 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/package.json +3 -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: b6101dc3457c93144c655cae80d5d7be64f420cb878166e025a527940d287a41
|
4
|
+
data.tar.gz: 1840f3bf32f56c644de27c082a18c3241b145e4ac3d1696e672ffaa2cffd4099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8f65034a64aa88c9ca2565b8e6543735dd726974751c5adb0a848192fe1098aee310d31b81c6d64862c91120d21766a7b204fe3c6d8b629faa6fa3452e70f79
|
7
|
+
data.tar.gz: 5a440b76b2b4f7fd4f2dc5685e2e141fa9cf5811c271d1b067ab5b1d343826e97f6ce177f327cba9e2a4e76b53b7b1b50d1b2fa87873e782998d8aed0234a7e1
|
@@ -8,7 +8,7 @@ module ForemanRemoteExecution
|
|
8
8
|
|
9
9
|
def multiple_actions
|
10
10
|
res = super
|
11
|
-
res += [ [_('Schedule Remote Job'), new_job_invocation_path, false] ] if
|
11
|
+
res += [ [_('Schedule Remote Job'), new_job_invocation_path, false] ] if can_schedule_jobs?
|
12
12
|
res
|
13
13
|
end
|
14
14
|
|
@@ -22,20 +22,20 @@ module ForemanRemoteExecution
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def rex_host_features(*
|
26
|
-
return unless
|
25
|
+
def rex_host_features(host, *_rest)
|
26
|
+
return [] unless can_execute_on_host?(host)
|
27
27
|
RemoteExecutionFeature.with_host_action_button.order(:label).map do |feature|
|
28
|
-
link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [
|
28
|
+
link_to(_('%s') % feature.name, job_invocations_path(:host_ids => [host.id], :feature => feature.label), :method => :post)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def schedule_job_button(*
|
33
|
-
return unless
|
34
|
-
link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [
|
32
|
+
def schedule_job_button(host, *_rest)
|
33
|
+
return unless can_execute_on_host?(host)
|
34
|
+
link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [host.id]), :id => :run_button, :class => 'btn btn-default')
|
35
35
|
end
|
36
36
|
|
37
37
|
def web_console_button(host, *args)
|
38
|
-
return
|
38
|
+
return if !authorized_for(permission: 'cockpit_hosts', auth_object: host) || !can_execute_on_infrastructure_host?(host)
|
39
39
|
|
40
40
|
url = SSHExecutionProvider.cockpit_url_for_host(host.name)
|
41
41
|
url ? link_to(_('Web Console'), url, :class => 'btn btn-default', :id => :'web-console-button', :target => '_new') : nil
|
@@ -46,6 +46,17 @@ module ForemanRemoteExecution
|
|
46
46
|
button_group(web_console_button(*args)))
|
47
47
|
super(*args)
|
48
48
|
end
|
49
|
-
end
|
50
49
|
|
50
|
+
def can_schedule_jobs?
|
51
|
+
authorized_for(controller: :job_invocations, action: :create)
|
52
|
+
end
|
53
|
+
|
54
|
+
def can_execute_on_host?(host)
|
55
|
+
can_schedule_jobs? && can_execute_on_infrastructure_host?(host)
|
56
|
+
end
|
57
|
+
|
58
|
+
def can_execute_on_infrastructure_host?(host)
|
59
|
+
!host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts)
|
60
|
+
end
|
61
|
+
end
|
51
62
|
end
|
@@ -31,7 +31,7 @@ module RemoteExecutionHelper
|
|
31
31
|
|
32
32
|
if authorized_for(hash_for_host_path(host).merge(auth_object: host, permission: :view_hosts, authorizer: job_hosts_authorizer))
|
33
33
|
links << { title: _('Host detail'),
|
34
|
-
action: { href:
|
34
|
+
action: { href: current_host_details_path(host), 'data-method': 'get', id: "#{host.name}-actions-detail" } }
|
35
35
|
end
|
36
36
|
|
37
37
|
if authorized_for(hash_for_rerun_job_invocation_path(id: job_invocation, host_ids: [ host.id ], authorizer: job_hosts_authorizer))
|
@@ -147,9 +147,10 @@ module RemoteExecutionHelper
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
def invocation_description(invocation)
|
150
|
+
def invocation_description(invocation, keep_tooltip: true)
|
151
151
|
description = invocation.description.try(:capitalize) || invocation.job_category
|
152
|
-
trunc_with_tooltip(description, 80)
|
152
|
+
description = trunc_with_tooltip(description, 80) if keep_tooltip
|
153
|
+
description
|
153
154
|
end
|
154
155
|
|
155
156
|
def invocation_result(invocation, key)
|
@@ -121,6 +121,10 @@ module ForemanRemoteExecution
|
|
121
121
|
@cached_rex_host_params_hash = nil
|
122
122
|
end
|
123
123
|
|
124
|
+
def infrastructure_host?
|
125
|
+
infrastructure_facet&.foreman_instance || infrastructure_facet&.smart_proxy_id
|
126
|
+
end
|
127
|
+
|
124
128
|
private
|
125
129
|
|
126
130
|
def extend_host_params_hash(params)
|
data/app/models/targeting.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
</tr>
|
11
11
|
<% JobInvocation.latest_jobs.each do |invocation| %>
|
12
12
|
<tr>
|
13
|
-
<td class="ellipsis"><%= link_to_if_authorized invocation_description(invocation), hash_for_job_invocation_path(invocation).merge(:auth_object => invocation, :permission => :view_job_invocations, :authorizer => authorizer) %></td>
|
13
|
+
<td class="ellipsis"><%= link_to_if_authorized invocation_description(invocation, keep_tooltip: false), hash_for_job_invocation_path(invocation).merge(:auth_object => invocation, :permission => :view_job_invocations, :authorizer => authorizer) %></td>
|
14
14
|
<td><%= link_to_invocation_task_if_authorized(invocation) %></td>
|
15
15
|
<td><%= time_in_words_span(invocation.start_at) %></td>
|
16
16
|
</tr>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<% if @hosts.any? -%>
|
8
8
|
<ul>
|
9
9
|
<% @hosts.each do |host| -%>
|
10
|
-
<li><%= link_to h(host.name),
|
10
|
+
<li><%= link_to h(host.name), current_host_details_path(host), :target => '_blank' %></li>
|
11
11
|
<% end -%>
|
12
12
|
|
13
13
|
<% if @additional > 0 -%>
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<% if @host %>
|
31
|
-
<h3><%= _('Target: ') %><%= link_to(@host.name,
|
31
|
+
<h3><%= _('Target: ') %><%= link_to(@host.name, current_host_details_path(@host)) %></h3>
|
32
32
|
|
33
33
|
<div class="preview hidden">
|
34
34
|
<%= preview_box(@template_invocation, @host) %>
|
@@ -214,7 +214,11 @@ module ForemanRemoteExecution
|
|
214
214
|
role 'Remote Execution User', USER_PERMISSIONS, 'Role with permissions to run remote execution jobs against hosts'
|
215
215
|
role 'Remote Execution Manager', MANAGER_PERMISSIONS, 'Role with permissions to manage job templates, remote execution features, cancel jobs and view audit logs'
|
216
216
|
|
217
|
-
add_all_permissions_to_default_roles
|
217
|
+
add_all_permissions_to_default_roles(except: [:execute_jobs_on_infrastructure_hosts])
|
218
|
+
add_permissions_to_default_roles({
|
219
|
+
Role::MANAGER => [:execute_jobs_on_infrastructure_hosts],
|
220
|
+
Role::SITE_MANAGER => USER_PERMISSIONS + [:execute_jobs_on_infrastructure_hosts],
|
221
|
+
})
|
218
222
|
|
219
223
|
# add menu entry
|
220
224
|
menu :top_menu, :job_templates,
|
data/package.json
CHANGED
@@ -30,7 +30,9 @@
|
|
30
30
|
"eslint": "^6.8.0",
|
31
31
|
"prettier": "^1.19.1",
|
32
32
|
"@patternfly/react-catalog-view-extension": "^4.8.126",
|
33
|
-
"redux-mock-store": "^1.2.2"
|
33
|
+
"redux-mock-store": "^1.2.2",
|
34
|
+
"graphql-tag": "^2.11.0",
|
35
|
+
"graphql": "^15.5.0"
|
34
36
|
},
|
35
37
|
"peerDependencies": {
|
36
38
|
"@theforeman/vendor": "^8.16.0"
|
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.0.3
|
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:
|
11
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|