foreman_remote_execution 5.1.0 → 6.0.0
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/README.md +7 -0
- data/app/controllers/ui_job_wizard_controller.rb +12 -1
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +20 -9
- data/app/helpers/remote_execution_helper.rb +1 -1
- data/app/mailers/rex_job_mailer.rb +1 -1
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +4 -0
- data/app/models/targeting.rb +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 +6 -2
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/action_names.rb +3 -4
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +356 -20
- data/locale/en/foreman_remote_execution.po +356 -20
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +356 -20
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +357 -21
- data/locale/foreman_remote_execution.pot +808 -296
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +357 -21
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +357 -21
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +356 -20
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +357 -21
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +356 -20
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +357 -21
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +356 -20
- data/webpack/JobWizard/JobWizard.js +22 -5
- data/webpack/JobWizard/JobWizard.scss +5 -0
- data/webpack/JobWizard/JobWizardConstants.js +2 -1
- data/webpack/JobWizard/__tests__/fixtures.js +13 -2
- data/webpack/JobWizard/__tests__/integration.test.js +6 -1
- data/webpack/JobWizard/autofill.js +34 -9
- data/webpack/JobWizard/index.js +0 -7
- data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +25 -7
- data/webpack/JobWizard/steps/HostsAndInputs/HostSearch.js +1 -1
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +28 -0
- data/webpack/JobWizard/steps/Schedule/RepeatOn.js +1 -1
- data/webpack/JobWizard/steps/form/Formatter.js +18 -3
- data/webpack/__mocks__/foremanReact/components/Pagination.js +2 -0
- data/webpack/__mocks__/foremanReact/constants.js +1 -0
- data/webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js +1 -1
- data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +1 -6
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -9
- data/webpack/react_app/components/TargetingHosts/index.js +2 -3
- metadata +3 -4
- data/app/views/templates/README.md +0 -6
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d64bd14e3ce43367e26ad39ec10408baf8ec7920f45aa4ea1353340d3cf742
|
4
|
+
data.tar.gz: 0ab68114a29368fa4c2a269287b875368cdcc31db63dd481df223a1f91a36cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d908f4f766c2b55bf6814035058b5faea29ba1ae3c61729275d2492e62b5f5aba2f60838d0b8383b9075f75daed15788d34ae1b2b9e091fea3ec26f812c670a
|
7
|
+
data.tar.gz: 05d63bba759d31d2b85030bc8cb4e39faeb9af50e784374e016edb4637d84906f6527b533efd5600da969a1b2315f34392f5f994d1ae17bbc840f5a2dfdf04a9
|
data/README.md
CHANGED
@@ -24,6 +24,13 @@ management functionality with remote management functionality.
|
|
24
24
|
|
25
25
|
Check the Foreman manual [remote execution section](http://theforeman.org/plugins/foreman_remote_execution/)
|
26
26
|
|
27
|
+
## Compatibility
|
28
|
+
|
29
|
+
| Foreman Version | Plugin Version |
|
30
|
+
| --------------- | -------------- |
|
31
|
+
| >= 3.1 | ~> 5.0.0 |
|
32
|
+
| >= 3.2 | >= 6.0.0 |
|
33
|
+
|
27
34
|
## Simulated runs
|
28
35
|
There is an option to use an alternative `ScriptRunner` implementation. Instead of doing ssh connections it discards any input its given and gives back fake output.
|
29
36
|
|
@@ -3,10 +3,11 @@ class UiJobWizardController < ApplicationController
|
|
3
3
|
def categories
|
4
4
|
job_categories = resource_scope
|
5
5
|
.search_for("job_category ~ \"#{params[:search]}\"")
|
6
|
+
.where(:snippet => false)
|
6
7
|
.select(:job_category).distinct
|
7
8
|
.reorder(:job_category)
|
8
9
|
.pluck(:job_category)
|
9
|
-
render :json => {:job_categories =>job_categories, :with_katello => with_katello}
|
10
|
+
render :json => {:job_categories => job_categories, :with_katello => with_katello, default_category: default_category, default_template: default_template&.id}
|
10
11
|
end
|
11
12
|
|
12
13
|
def template
|
@@ -24,6 +25,16 @@ class UiJobWizardController < ApplicationController
|
|
24
25
|
template_inputs_with_foreign.map { |input| input.attributes.merge({:resource_type_tableize => input.resource_type&.tableize }) }
|
25
26
|
end
|
26
27
|
|
28
|
+
def default_category
|
29
|
+
default_template&.job_category
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_template
|
33
|
+
if (setting_value = Setting['remote_execution_form_job_template'])
|
34
|
+
JobTemplate.authorized(:view_job_templates).find_by :name => setting_value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
27
38
|
def resource_name(nested_resource = nil)
|
28
39
|
nested_resource || 'job_template'
|
29
40
|
end
|
@@ -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))
|
@@ -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
@@ -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 -%>
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
<% if @host %>
|
31
31
|
<% proxy_id = @template_invocation_task.input[:proxy_id] %>
|
32
32
|
<h3>
|
33
|
-
<%= _('Target: ') %><%= link_to(@host.name,
|
33
|
+
<%= _('Target: ') %><%= link_to(@host.name, current_host_details_path(@host)) %>
|
34
34
|
<% if proxy_id && proxy = SmartProxy.find_by(id: proxy_id) %>
|
35
35
|
<%= _('using Smart Proxy') %> <%= link_to(proxy.name, smart_proxy_path(proxy)) %>
|
36
36
|
<% end %>
|
@@ -47,7 +47,7 @@ module ForemanRemoteExecution
|
|
47
47
|
|
48
48
|
initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |_app|
|
49
49
|
Foreman::Plugin.register :foreman_remote_execution do
|
50
|
-
requires_foreman '>= 3.
|
50
|
+
requires_foreman '>= 3.2'
|
51
51
|
register_global_js_file 'global'
|
52
52
|
|
53
53
|
apipie_documented_controllers ["#{ForemanRemoteExecution::Engine.root}/app/controllers/api/v2/*.rb"]
|
@@ -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/locale/action_names.rb
CHANGED
Binary file
|