foreman_remote_execution 5.0.4 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +7 -0
- data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb +5 -0
- data/app/controllers/ui_job_wizard_controller.rb +13 -2
- data/app/helpers/remote_execution_helper.rb +1 -1
- data/app/lib/actions/remote_execution/run_host_job.rb +3 -1
- data/app/lib/foreman_remote_execution/renderer/scope/input.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/job_invocation.rb +2 -0
- data/app/models/job_template.rb +3 -1
- data/app/models/remote_execution_provider.rb +10 -1
- data/app/models/ssh_execution_provider.rb +8 -2
- data/app/views/api/v2/host/main.rabl +1 -0
- data/app/views/job_templates/_custom_tabs.html.erb +4 -9
- data/app/views/template_invocations/show.html.erb +7 -1
- data/app/views/templates/{ssh → script}/check_update.erb +2 -2
- data/app/views/templates/{ssh → script}/module_action.erb +2 -2
- data/app/views/templates/{ssh → script}/package_action.erb +2 -2
- data/app/views/templates/{ssh → script}/power_action.erb +2 -2
- data/app/views/templates/{ssh → script}/puppet_agent_disable.erb +2 -2
- data/app/views/templates/{ssh → script}/puppet_agent_enable.erb +2 -2
- data/app/views/templates/{ssh → script}/puppet_install_modules_from_forge.erb +2 -2
- data/app/views/templates/{ssh → script}/puppet_install_modules_from_git.erb +2 -2
- data/app/views/templates/{ssh → script}/puppet_run_once.erb +2 -2
- data/app/views/templates/{ssh → script}/run_command.erb +2 -2
- data/app/views/templates/{ssh → script}/service_action.erb +2 -2
- data/db/migrate/20220321101835_rename_ssh_provider_to_script.rb +29 -0
- data/jsconfig.json +8 -0
- data/lib/foreman_remote_execution/engine.rb +6 -4
- 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/package.json +6 -7
- data/test/unit/job_invocation_report_template_test.rb +1 -1
- data/test/unit/remote_execution_provider_test.rb +2 -0
- data/test/unit/targeting_test.rb +1 -1
- data/webpack/JobWizard/JobWizard.js +30 -7
- 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/CategoryAndTemplate.js +24 -15
- 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/JobWizard/steps/form/GroupedSelectField.js +7 -1
- data/webpack/__mocks__/foremanReact/components/Pagination.js +2 -0
- data/webpack/__mocks__/foremanReact/constants.js +1 -0
- data/webpack/global_index.js +4 -0
- data/webpack/react_app/components/FeaturesDropdown/actions.js +13 -0
- data/webpack/react_app/components/FeaturesDropdown/constant.js +2 -0
- data/webpack/react_app/components/FeaturesDropdown/index.js +74 -0
- data/webpack/react_app/components/HostKebab/KebabItems.js +22 -0
- data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +6 -1
- data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
- data/webpack/react_app/components/RecentJobsCard/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
- data/webpack/react_app/extend/fillKebabItems.js +11 -0
- data/webpack/react_app/extend/fillRexFeaturesDropdown.js +11 -0
- metadata +24 -16
- 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: 910d4fd508188efbad4cfb121085171d077d65881e7ef8b5c9f1dea4092aa182
|
4
|
+
data.tar.gz: af7a5ca195d2b0d6ba269962bb3d726cd19dd6cc23358e6e6dc21cc77b36b3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030ed44dd17a6da7b334f3c3621d34cec9d4afc6323f2cbacd1054716520dc4f955f5da4d0aa5bfb93b0f83699c6dd15a3d75a9ff770fa1b9c5d6df2afbba440
|
7
|
+
data.tar.gz: 80d41c53f5e1620919069e08a97b23d22d884406275ad426b49ee08c97dc92c958762fe79ff5bb703b63859f1551fb3cfad838f1b63e75cbc143983dc864e7fd
|
data/Gemfile
CHANGED
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
|
|
data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb
CHANGED
@@ -13,6 +13,7 @@ module ForemanRemoteExecution
|
|
13
13
|
|
14
14
|
def host_setup_extension
|
15
15
|
remote_execution_interface
|
16
|
+
reset_host_known_keys! unless @host.new_record?
|
16
17
|
super
|
17
18
|
end
|
18
19
|
|
@@ -21,6 +22,10 @@ module ForemanRemoteExecution
|
|
21
22
|
|
22
23
|
@host.set_execution_interface(params['remote_execution_interface'])
|
23
24
|
end
|
25
|
+
|
26
|
+
def reset_host_known_keys!
|
27
|
+
@host.host_proxy_invocations.destroy_all
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -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,12 +25,22 @@ 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
|
30
41
|
|
31
42
|
def with_katello
|
32
|
-
|
43
|
+
::Foreman::Plugin.installed? 'katello'
|
33
44
|
end
|
34
45
|
|
35
46
|
def resource_class
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RemoteExecutionHelper
|
2
2
|
def providers_options
|
3
|
-
RemoteExecutionProvider.providers.map { |key, provider| [ key, _(provider.humanized_name) ] }
|
3
|
+
RemoteExecutionProvider.providers.reject { |key, _provider| key == 'SSH' }.map { |key, provider| [ key, _(provider.humanized_name) ] }
|
4
4
|
end
|
5
5
|
|
6
6
|
def job_hosts_authorizer
|
@@ -40,8 +40,10 @@ module Actions
|
|
40
40
|
provider = template_invocation.template.provider
|
41
41
|
proxy_selector = provider.required_proxy_selector_for(template_invocation.template) || proxy_selector
|
42
42
|
|
43
|
-
provider_type =
|
43
|
+
provider_type = provider.proxy_feature
|
44
44
|
proxy = determine_proxy!(proxy_selector, provider_type, host)
|
45
|
+
link!(proxy)
|
46
|
+
input[:proxy_id] = proxy.id
|
45
47
|
|
46
48
|
renderer = InputTemplateRenderer.new(template_invocation.template, host, template_invocation)
|
47
49
|
script = renderer.render
|
@@ -98,7 +98,7 @@ module ForemanRemoteExecution
|
|
98
98
|
def input(name)
|
99
99
|
return template_input_values[name.to_s] if template_input_values.key?(name.to_s)
|
100
100
|
|
101
|
-
input = find_by_name(template.template_inputs_with_foreign, name)
|
101
|
+
input = find_by_name(template.template_inputs_with_foreign, name)
|
102
102
|
if input
|
103
103
|
@preview ? input.preview(self) : input.value(self)
|
104
104
|
else
|
@@ -46,6 +46,10 @@ module ForemanRemoteExecution
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def cockpit_url
|
50
|
+
SSHExecutionProvider.cockpit_url_for_host(self.name)
|
51
|
+
end
|
52
|
+
|
49
53
|
def execution_status(options = {})
|
50
54
|
@execution_status ||= get_status(HostStatus::ExecutionStatus).to_status(options)
|
51
55
|
end
|
@@ -15,8 +15,10 @@ class JobInvocation < ApplicationRecord
|
|
15
15
|
|
16
16
|
belongs_to :targeting, :dependent => :destroy
|
17
17
|
has_many :all_template_invocations, :inverse_of => :job_invocation, :dependent => :destroy, :class_name => 'TemplateInvocation'
|
18
|
+
# rubocop:disable Rails/HasManyOrHasOneDependent
|
18
19
|
has_many :template_invocations, -> { where('template_invocations.host_id IS NOT NULL') }, :inverse_of => :job_invocation
|
19
20
|
has_many :pattern_template_invocations, -> { where('template_invocations.host_id IS NULL') }, :inverse_of => :job_invocation, :class_name => 'TemplateInvocation'
|
21
|
+
# rubocop:enable Rails/HasManyOrHasOneDependent
|
20
22
|
has_many :pattern_templates, :through => :pattern_template_invocations, :source => :template
|
21
23
|
|
22
24
|
validates :targeting, :presence => true
|
data/app/models/job_template.rb
CHANGED
@@ -17,8 +17,10 @@ class JobTemplate < ::Template
|
|
17
17
|
|
18
18
|
has_many :audits, :as => :auditable, :class_name => Audited.audit_class.name, :dependent => :nullify
|
19
19
|
has_many :all_template_invocations, :dependent => :destroy, :foreign_key => 'template_id', :class_name => 'TemplateInvocation'
|
20
|
+
# rubocop:disable Rails/HasManyOrHasOneDependent
|
20
21
|
has_many :template_invocations, -> { where('host_id IS NOT NULL') }, :foreign_key => 'template_id'
|
21
22
|
has_many :pattern_template_invocations, -> { where('host_id IS NULL') }, :foreign_key => 'template_id', :class_name => 'TemplateInvocation'
|
23
|
+
# rubocop:enable Rails/HasManyOrHasOneDependent
|
22
24
|
has_many :remote_execution_features, :dependent => :nullify
|
23
25
|
|
24
26
|
# these can't be shared in parent class, scoped search can't handle STI properly
|
@@ -192,7 +194,7 @@ class JobTemplate < ::Template
|
|
192
194
|
end
|
193
195
|
|
194
196
|
def default_input_values(ignore_keys)
|
195
|
-
result = self.template_inputs_with_foreign.select { |ti| !ti.required? && ti.
|
197
|
+
result = self.template_inputs_with_foreign.select { |ti| !ti.required? && ti.input_type == 'user' }.map { |ti| ti.name.to_s }
|
196
198
|
result -= ignore_keys.map(&:to_s)
|
197
199
|
Hash[result.map { |k| [ k, nil ] }]
|
198
200
|
end
|
@@ -4,7 +4,16 @@ class RemoteExecutionProvider
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def provider_for(type)
|
7
|
-
providers[type.to_s] || providers[:
|
7
|
+
providers[type.to_s] || providers[:script]
|
8
|
+
end
|
9
|
+
|
10
|
+
def registered_name
|
11
|
+
klass = self
|
12
|
+
providers.key(klass)
|
13
|
+
end
|
14
|
+
|
15
|
+
def proxy_feature
|
16
|
+
registered_name
|
8
17
|
end
|
9
18
|
|
10
19
|
def providers
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class ScriptExecutionProvider < RemoteExecutionProvider
|
2
2
|
class << self
|
3
3
|
def proxy_command_options(template_invocation, host)
|
4
4
|
super.merge(:ssh_user => ssh_user(host),
|
@@ -9,7 +9,7 @@ class SSHExecutionProvider < RemoteExecutionProvider
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def humanized_name
|
12
|
-
_('
|
12
|
+
_('Script')
|
13
13
|
end
|
14
14
|
|
15
15
|
def supports_effective_user?
|
@@ -53,6 +53,10 @@ class SSHExecutionProvider < RemoteExecutionProvider
|
|
53
53
|
Setting[:remote_execution_cockpit_url] % { :host => host } if Setting[:remote_execution_cockpit_url].present?
|
54
54
|
end
|
55
55
|
|
56
|
+
def proxy_feature
|
57
|
+
'SSH'
|
58
|
+
end
|
59
|
+
|
56
60
|
private
|
57
61
|
|
58
62
|
def ssh_user(host)
|
@@ -64,3 +68,5 @@ class SSHExecutionProvider < RemoteExecutionProvider
|
|
64
68
|
end
|
65
69
|
end
|
66
70
|
end
|
71
|
+
|
72
|
+
SSHExecutionProvider = ScriptExecutionProvider
|
@@ -0,0 +1 @@
|
|
1
|
+
attributes :cockpit_url
|
@@ -1,14 +1,9 @@
|
|
1
1
|
<div class="tab-pane" id="template_job">
|
2
2
|
|
3
|
-
<%=
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
:name => 'job_template[job_category]',
|
8
|
-
:id => 'search',
|
9
|
-
:disabled => @template.locked?) %>
|
10
|
-
<% end %>
|
11
|
-
|
3
|
+
<%= autocomplete_f(f, :job_category,
|
4
|
+
:search_query => '',
|
5
|
+
:placeholder => _("Job category") + ' ...',
|
6
|
+
:disabled => @template.locked?) %>
|
12
7
|
<%= text_f f, :description_format,
|
13
8
|
:disabled => @template.locked?,
|
14
9
|
:label_help => description_format_help %>
|
@@ -28,7 +28,13 @@ end
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<% if @host %>
|
31
|
-
|
31
|
+
<% proxy_id = @template_invocation_task.input[:proxy_id] %>
|
32
|
+
<h3>
|
33
|
+
<%= _('Target: ') %><%= link_to(@host.name, current_host_details_path(@host)) %>
|
34
|
+
<% if proxy_id && proxy = SmartProxy.find_by(id: proxy_id) %>
|
35
|
+
<%= _('using Smart Proxy') %> <%= link_to(proxy.name, smart_proxy_path(proxy)) %>
|
36
|
+
<% end %>
|
37
|
+
</h3>
|
32
38
|
|
33
39
|
<div class="preview hidden">
|
34
40
|
<%= preview_box(@template_invocation, @host) %>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Module Action -
|
3
|
+
name: Module Action - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Modules
|
6
6
|
description_format: "Module %{action} %{module_spec}"
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: pre_script
|
10
10
|
description: A script to run prior to the module action
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Package Action -
|
3
|
+
name: Package Action - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Packages
|
6
6
|
description_format: "%{action} package(s) %{package}"
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: pre_script
|
10
10
|
description: A script to run prior to the package action
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Power Action -
|
3
|
+
name: Power Action - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Power
|
6
6
|
description_format: '%{action} host'
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: action
|
10
10
|
description: Action to perform on the service
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%#
|
2
|
-
name: Puppet Agent Disable -
|
2
|
+
name: Puppet Agent Disable - Script Default
|
3
3
|
model: JobTemplate
|
4
4
|
job_category: Puppet
|
5
5
|
description_format: Disable Puppet agent
|
@@ -10,7 +10,7 @@ template_inputs:
|
|
10
10
|
input_type: user
|
11
11
|
description: Reason for disabling the Puppet agent
|
12
12
|
advanced: false
|
13
|
-
provider_type:
|
13
|
+
provider_type: script
|
14
14
|
kind: job_template
|
15
15
|
-%>
|
16
16
|
<% if @host.operatingsystem.family == 'Debian' -%>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
|
-
name: Puppet Agent Enable -
|
2
|
+
name: Puppet Agent Enable - Script Default
|
3
3
|
model: JobTemplate
|
4
4
|
job_category: Puppet
|
5
5
|
description_format: Enable Puppet agent
|
6
6
|
snippet: false
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
kind: job_template
|
9
9
|
-%>
|
10
10
|
<% if @host.operatingsystem.family == 'Debian' -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%#
|
2
|
-
name: Puppet Module - Install from forge -
|
2
|
+
name: Puppet Module - Install from forge - Script Default
|
3
3
|
model: JobTemplate
|
4
4
|
job_category: Puppet
|
5
5
|
description_format: Install Puppet Module "%{puppet_module}" from forge
|
@@ -30,7 +30,7 @@ template_inputs:
|
|
30
30
|
input_type: user
|
31
31
|
description: Do not attempt to install dependencies. Type "true" to ignore dependencies.
|
32
32
|
advanced: true
|
33
|
-
provider_type:
|
33
|
+
provider_type: script
|
34
34
|
kind: job_template
|
35
35
|
-%>
|
36
36
|
<% if @host.operatingsystem.family == 'Debian' -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%#
|
2
|
-
name: Puppet Module - Install from git -
|
2
|
+
name: Puppet Module - Install from git - Script Default
|
3
3
|
model: JobTemplate
|
4
4
|
job_category: Puppet
|
5
5
|
description_format: Install Puppet Module "%{puppet_module}" from git
|
@@ -15,7 +15,7 @@ template_inputs:
|
|
15
15
|
input_type: user
|
16
16
|
description: For example, '/etc/puppetlabs/code/environments/production/modules/puppet'.
|
17
17
|
advanced: false
|
18
|
-
provider_type:
|
18
|
+
provider_type: script
|
19
19
|
kind: job_template
|
20
20
|
-%>
|
21
21
|
git clone <%= input('git_repository') %> <%= input('target_dir') %>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Puppet Run Once -
|
3
|
+
name: Puppet Run Once - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Puppet
|
6
6
|
description_format: 'Run Puppet once with "%{puppet_options}"'
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: puppet_options
|
10
10
|
description: Additional options to pass to puppet
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Run Command -
|
3
|
+
name: Run Command - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Commands
|
6
6
|
description_format: "Run %{command}"
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: command
|
10
10
|
description: Command to run on the host
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<%#
|
2
2
|
kind: job_template
|
3
|
-
name: Service Action -
|
3
|
+
name: Service Action - Script Default
|
4
4
|
model: JobTemplate
|
5
5
|
job_category: Services
|
6
6
|
description_format: '%{action} service %{service}'
|
7
|
-
provider_type:
|
7
|
+
provider_type: script
|
8
8
|
template_inputs:
|
9
9
|
- name: action
|
10
10
|
description: Action to perform on the service
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RenameSshProviderToScript < ActiveRecord::Migration[6.0]
|
4
|
+
|
5
|
+
def do_change(from, to, from_re, new_label)
|
6
|
+
setting = Setting.find_by(:name => 'remote_execution_form_job_template')
|
7
|
+
default_template = nil
|
8
|
+
|
9
|
+
Template.where(:provider_type => from).each do |t|
|
10
|
+
default_template = t if t.name == setting&.value
|
11
|
+
t.provider_type = to
|
12
|
+
t.name = t.name.gsub(from_re, new_label)
|
13
|
+
t.save!
|
14
|
+
end
|
15
|
+
|
16
|
+
if default_template
|
17
|
+
setting.value = default_template.name
|
18
|
+
setting.save!
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def up
|
23
|
+
do_change 'SSH', 'script', /SSH Default$/, 'Script Default'
|
24
|
+
end
|
25
|
+
|
26
|
+
def down
|
27
|
+
do_change 'script', 'SSH', /Script Default$/, 'SSH Default'
|
28
|
+
end
|
29
|
+
end
|
data/jsconfig.json
ADDED
@@ -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"]
|
@@ -146,13 +146,13 @@ module ForemanRemoteExecution
|
|
146
146
|
setting 'remote_execution_form_job_template',
|
147
147
|
type: :string,
|
148
148
|
description: N_('Choose a job template that is pre-selected in job invocation form'),
|
149
|
-
default: 'Run Command -
|
149
|
+
default: 'Run Command - Script Default',
|
150
150
|
full_name: N_('Form Job Template'),
|
151
151
|
collection: proc { Hash[JobTemplate.unscoped.map { |template| [template.name, template.name] }] }
|
152
152
|
setting 'remote_execution_job_invocation_report_template',
|
153
153
|
type: :string,
|
154
154
|
description: N_('Select a report template used for generating a report for a particular remote execution job'),
|
155
|
-
default: '
|
155
|
+
default: 'Job invocation - report template',
|
156
156
|
full_name: N_('Job Invocation Report Template'),
|
157
157
|
collection: proc { ForemanRemoteExecution.job_invocation_report_templates_select }
|
158
158
|
end
|
@@ -265,6 +265,7 @@ module ForemanRemoteExecution
|
|
265
265
|
extend_rabl_template 'api/v2/smart_proxies/main', 'api/v2/smart_proxies/pubkey'
|
266
266
|
extend_rabl_template 'api/v2/interfaces/main', 'api/v2/interfaces/execution_flag'
|
267
267
|
extend_rabl_template 'api/v2/subnets/show', 'api/v2/subnets/remote_execution_proxies'
|
268
|
+
extend_rabl_template 'api/v2/hosts/main', 'api/v2/host/main'
|
268
269
|
parameter_filter ::Subnet, :remote_execution_proxy_ids
|
269
270
|
describe_host { overview_buttons_provider :host_overview_buttons }
|
270
271
|
|
@@ -328,7 +329,8 @@ module ForemanRemoteExecution
|
|
328
329
|
require_dependency 'foreman_tasks/task'
|
329
330
|
ForemanTasks::Task.include ForemanRemoteExecution::ForemanTasksTaskExtensions
|
330
331
|
ForemanTasks::Cleaner.include ForemanRemoteExecution::ForemanTasksCleanerExtensions
|
331
|
-
RemoteExecutionProvider.register(:SSH, SSHExecutionProvider)
|
332
|
+
RemoteExecutionProvider.register(:SSH, ::SSHExecutionProvider)
|
333
|
+
RemoteExecutionProvider.register(:script, ::ScriptExecutionProvider)
|
332
334
|
|
333
335
|
ForemanRemoteExecution.register_rex_feature
|
334
336
|
|
data/locale/action_names.rb
CHANGED
Binary file
|