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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +7 -0
  4. data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb +5 -0
  5. data/app/controllers/ui_job_wizard_controller.rb +13 -2
  6. data/app/helpers/remote_execution_helper.rb +1 -1
  7. data/app/lib/actions/remote_execution/run_host_job.rb +3 -1
  8. data/app/lib/foreman_remote_execution/renderer/scope/input.rb +1 -1
  9. data/app/mailers/rex_job_mailer.rb +1 -1
  10. data/app/models/concerns/foreman_remote_execution/host_extensions.rb +4 -0
  11. data/app/models/job_invocation.rb +2 -0
  12. data/app/models/job_template.rb +3 -1
  13. data/app/models/remote_execution_provider.rb +10 -1
  14. data/app/models/ssh_execution_provider.rb +8 -2
  15. data/app/views/api/v2/host/main.rabl +1 -0
  16. data/app/views/job_templates/_custom_tabs.html.erb +4 -9
  17. data/app/views/template_invocations/show.html.erb +7 -1
  18. data/app/views/templates/{ssh → script}/check_update.erb +2 -2
  19. data/app/views/templates/{ssh → script}/module_action.erb +2 -2
  20. data/app/views/templates/{ssh → script}/package_action.erb +2 -2
  21. data/app/views/templates/{ssh → script}/power_action.erb +2 -2
  22. data/app/views/templates/{ssh → script}/puppet_agent_disable.erb +2 -2
  23. data/app/views/templates/{ssh → script}/puppet_agent_enable.erb +2 -2
  24. data/app/views/templates/{ssh → script}/puppet_install_modules_from_forge.erb +2 -2
  25. data/app/views/templates/{ssh → script}/puppet_install_modules_from_git.erb +2 -2
  26. data/app/views/templates/{ssh → script}/puppet_run_once.erb +2 -2
  27. data/app/views/templates/{ssh → script}/run_command.erb +2 -2
  28. data/app/views/templates/{ssh → script}/service_action.erb +2 -2
  29. data/db/migrate/20220321101835_rename_ssh_provider_to_script.rb +29 -0
  30. data/jsconfig.json +8 -0
  31. data/lib/foreman_remote_execution/engine.rb +6 -4
  32. data/lib/foreman_remote_execution/version.rb +1 -1
  33. data/locale/action_names.rb +3 -4
  34. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  35. data/locale/de/foreman_remote_execution.po +356 -20
  36. data/locale/en/foreman_remote_execution.po +356 -20
  37. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  38. data/locale/en_GB/foreman_remote_execution.po +356 -20
  39. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/es/foreman_remote_execution.po +357 -21
  41. data/locale/foreman_remote_execution.pot +808 -296
  42. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  43. data/locale/fr/foreman_remote_execution.po +357 -21
  44. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  45. data/locale/ja/foreman_remote_execution.po +357 -21
  46. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  47. data/locale/ko/foreman_remote_execution.po +356 -20
  48. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  49. data/locale/pt_BR/foreman_remote_execution.po +357 -21
  50. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  51. data/locale/ru/foreman_remote_execution.po +356 -20
  52. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  53. data/locale/zh_CN/foreman_remote_execution.po +357 -21
  54. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  55. data/locale/zh_TW/foreman_remote_execution.po +356 -20
  56. data/package.json +6 -7
  57. data/test/unit/job_invocation_report_template_test.rb +1 -1
  58. data/test/unit/remote_execution_provider_test.rb +2 -0
  59. data/test/unit/targeting_test.rb +1 -1
  60. data/webpack/JobWizard/JobWizard.js +30 -7
  61. data/webpack/JobWizard/JobWizard.scss +5 -0
  62. data/webpack/JobWizard/JobWizardConstants.js +2 -1
  63. data/webpack/JobWizard/__tests__/fixtures.js +13 -2
  64. data/webpack/JobWizard/__tests__/integration.test.js +6 -1
  65. data/webpack/JobWizard/autofill.js +34 -9
  66. data/webpack/JobWizard/index.js +0 -7
  67. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +24 -15
  68. data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +25 -7
  69. data/webpack/JobWizard/steps/HostsAndInputs/HostSearch.js +1 -1
  70. data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +28 -0
  71. data/webpack/JobWizard/steps/Schedule/RepeatOn.js +1 -1
  72. data/webpack/JobWizard/steps/form/Formatter.js +18 -3
  73. data/webpack/JobWizard/steps/form/GroupedSelectField.js +7 -1
  74. data/webpack/__mocks__/foremanReact/components/Pagination.js +2 -0
  75. data/webpack/__mocks__/foremanReact/constants.js +1 -0
  76. data/webpack/global_index.js +4 -0
  77. data/webpack/react_app/components/FeaturesDropdown/actions.js +13 -0
  78. data/webpack/react_app/components/FeaturesDropdown/constant.js +2 -0
  79. data/webpack/react_app/components/FeaturesDropdown/index.js +74 -0
  80. data/webpack/react_app/components/HostKebab/KebabItems.js +22 -0
  81. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +6 -1
  82. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
  83. data/webpack/react_app/components/RecentJobsCard/constants.js +1 -0
  84. data/webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js +1 -1
  85. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +1 -6
  86. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -9
  87. data/webpack/react_app/components/TargetingHosts/index.js +2 -3
  88. data/webpack/react_app/extend/fillKebabItems.js +11 -0
  89. data/webpack/react_app/extend/fillRexFeaturesDropdown.js +11 -0
  90. metadata +24 -16
  91. data/app/views/templates/README.md +0 -6
  92. 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: 59eae566c2961d0c2d5cca855d76ece120748f1c1f6303a5b2fca5928f1b4840
4
- data.tar.gz: 1cbb8e8f418e8b8c5823b9b875eed46873735da31b5214601acc60f236d650b1
3
+ metadata.gz: 910d4fd508188efbad4cfb121085171d077d65881e7ef8b5c9f1dea4092aa182
4
+ data.tar.gz: af7a5ca195d2b0d6ba269962bb3d726cd19dd6cc23358e6e6dc21cc77b36b3b2
5
5
  SHA512:
6
- metadata.gz: 77c04207ff68fc2cf97061b77b2d06c40b51f197d2cceb4fa803dc29e2e3512eb4b048131964414f2e29dbc23e2a460b1ff46566718b79e804f7632b375f12ea
7
- data.tar.gz: d9bf1681d7e5834c3cc16941a90c4c4c73db3d1b4e812c91b88ffe866bcb27f52eae3841a49740f77c50d0f8fd570203ea7f4f5100cc855ea140403cd0bda49e
6
+ metadata.gz: 030ed44dd17a6da7b334f3c3621d34cec9d4afc6323f2cbacd1054716520dc4f955f5da4d0aa5bfb93b0f83699c6dd15a3d75a9ff770fa1b9c5d6df2afbba440
7
+ data.tar.gz: 80d41c53f5e1620919069e08a97b23d22d884406275ad426b49ee08c97dc92c958762fe79ff5bb703b63859f1551fb3cfad838f1b63e75cbc143983dc864e7fd
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec :name => 'foreman_remote_execution'
4
4
 
5
- gem 'theforeman-rubocop', '~> 0.1.0.pre'
5
+ gem 'theforeman-rubocop', '~> 0.1.1'
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
 
@@ -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
- !!defined?(::Katello)
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 = template_invocation.template.provider_type.to_s
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) # rubocop:disable Rails/DynamicFindBy
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
@@ -1,5 +1,5 @@
1
1
  class RexJobMailer < ApplicationMailer
2
- add_template_helper(ApplicationHelper)
2
+ helper ApplicationHelper
3
3
 
4
4
  def job_finished(job, opts = {})
5
5
  @job = job
@@ -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
@@ -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.user_template_input? }.map { |ti| ti.name.to_s }
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[:SSH]
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 SSHExecutionProvider < RemoteExecutionProvider
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
- _('SSH')
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
- <%= field(f, :job_category, :label => _('Job category')) do %>
4
- <%= auto_complete_search(:job_category,
5
- f.object.job_category,
6
- :placeholder => _("Job category") + ' ...',
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
- <h3><%= _('Target: ') %><%= link_to(@host.name, current_host_details_path(@host)) %></h3>
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: Check Update - SSH Default
3
+ name: Check Update - Script Default
4
4
  model: JobTemplate
5
5
  job_category: Packages
6
6
  description_format: "Check for package updates"
7
- provider_type: SSH
7
+ provider_type: script
8
8
  %>
9
9
 
10
10
  <%
@@ -1,10 +1,10 @@
1
1
  <%#
2
2
  kind: job_template
3
- name: Module Action - SSH Default
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: SSH
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 - SSH Default
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: SSH
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 - SSH Default
3
+ name: Power Action - Script Default
4
4
  model: JobTemplate
5
5
  job_category: Power
6
6
  description_format: '%{action} host'
7
- provider_type: SSH
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 - SSH Default
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: SSH
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 - SSH Default
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: SSH
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 - SSH Default
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: SSH
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 - SSH Default
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: SSH
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 - SSH Default
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: SSH
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 - SSH Default
3
+ name: Run Command - Script Default
4
4
  model: JobTemplate
5
5
  job_category: Commands
6
6
  description_format: "Run %{command}"
7
- provider_type: SSH
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 - SSH Default
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: SSH
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
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "paths": {
5
+ "foremanReact/*": ["../foreman/webpack/assets/javascripts/react_app/*"]
6
+ }
7
+ }
8
+ }
@@ -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.1'
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 - SSH Default',
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: 'Jobs - Invocation report template',
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
 
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '5.0.4'.freeze
2
+ VERSION = '6.1.0'.freeze
3
3
  end
@@ -1,6 +1,5 @@
1
1
  # Autogenerated!
2
- _("Preupgrade job")
3
- _("Action with sub plans")
4
- _("Import facts")
5
- _("Import Puppet classes")
6
2
  _("Remote action:")
3
+ _("»Import facts«")
4
+ _("»Import Puppet classes«")
5
+ _("»Action with sub plans«")