foreman_remote_execution 5.1.0 → 6.2.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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/app/controllers/foreman_remote_execution/concerns/api/v2/registration_controller_extensions.rb +5 -0
  4. data/app/controllers/ui_job_wizard_controller.rb +13 -2
  5. data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +20 -9
  6. data/app/helpers/remote_execution_helper.rb +5 -4
  7. data/app/lib/actions/remote_execution/run_host_job.rb +1 -1
  8. data/app/mailers/rex_job_mailer.rb +1 -1
  9. data/app/models/concerns/foreman_remote_execution/host_extensions.rb +9 -1
  10. data/app/models/concerns/foreman_remote_execution/nic_extensions.rb +6 -4
  11. data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +1 -1
  12. data/app/models/job_invocation_composer.rb +1 -1
  13. data/app/models/remote_execution_provider.rb +10 -1
  14. data/app/models/ssh_execution_provider.rb +17 -4
  15. data/app/models/targeting.rb +1 -1
  16. data/app/services/default_proxy_proxy_selector.rb +1 -1
  17. data/app/services/remote_execution_proxy_selector.rb +7 -2
  18. data/app/views/api/v2/host/main.rabl +1 -0
  19. data/app/views/dashboard/_latest-jobs.html.erb +1 -1
  20. data/app/views/job_invocations/_preview_hosts_list.html.erb +1 -1
  21. data/app/views/template_invocations/show.html.erb +1 -1
  22. data/app/views/templates/{ssh → script}/check_update.erb +2 -2
  23. data/app/views/templates/{ssh → script}/module_action.erb +2 -2
  24. data/app/views/templates/{ssh → script}/package_action.erb +5 -2
  25. data/app/views/templates/{ssh → script}/power_action.erb +2 -2
  26. data/app/views/templates/{ssh → script}/puppet_agent_disable.erb +2 -2
  27. data/app/views/templates/{ssh → script}/puppet_agent_enable.erb +2 -2
  28. data/app/views/templates/{ssh → script}/puppet_install_modules_from_forge.erb +2 -2
  29. data/app/views/templates/{ssh → script}/puppet_install_modules_from_git.erb +2 -2
  30. data/app/views/templates/{ssh → script}/puppet_run_once.erb +2 -2
  31. data/app/views/templates/{ssh → script}/run_command.erb +2 -2
  32. data/app/views/templates/{ssh → script}/service_action.erb +2 -2
  33. data/db/migrate/20220321101835_rename_ssh_provider_to_script.rb +29 -0
  34. data/db/seeds.d/60-ssh_proxy_feature.rb +3 -0
  35. data/jsconfig.json +8 -0
  36. data/lib/foreman_remote_execution/engine.rb +10 -4
  37. data/lib/foreman_remote_execution/version.rb +1 -1
  38. data/locale/action_names.rb +3 -4
  39. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/de/foreman_remote_execution.po +356 -20
  41. data/locale/en/foreman_remote_execution.po +356 -20
  42. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  43. data/locale/en_GB/foreman_remote_execution.po +356 -20
  44. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  45. data/locale/es/foreman_remote_execution.po +357 -21
  46. data/locale/foreman_remote_execution.pot +808 -296
  47. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  48. data/locale/fr/foreman_remote_execution.po +357 -21
  49. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  50. data/locale/ja/foreman_remote_execution.po +357 -21
  51. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  52. data/locale/ko/foreman_remote_execution.po +356 -20
  53. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  54. data/locale/pt_BR/foreman_remote_execution.po +357 -21
  55. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  56. data/locale/ru/foreman_remote_execution.po +356 -20
  57. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  58. data/locale/zh_CN/foreman_remote_execution.po +357 -21
  59. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  60. data/locale/zh_TW/foreman_remote_execution.po +356 -20
  61. data/package.json +6 -7
  62. data/test/unit/concerns/host_extensions_test.rb +2 -1
  63. data/test/unit/remote_execution_provider_test.rb +2 -0
  64. data/webpack/JobWizard/JobWizard.js +30 -7
  65. data/webpack/JobWizard/JobWizard.scss +5 -0
  66. data/webpack/JobWizard/JobWizardConstants.js +2 -1
  67. data/webpack/JobWizard/__tests__/fixtures.js +13 -2
  68. data/webpack/JobWizard/__tests__/integration.test.js +6 -1
  69. data/webpack/JobWizard/autofill.js +34 -9
  70. data/webpack/JobWizard/index.js +0 -7
  71. data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js +24 -15
  72. data/webpack/JobWizard/steps/CategoryAndTemplate/index.js +25 -7
  73. data/webpack/JobWizard/steps/HostsAndInputs/HostSearch.js +1 -1
  74. data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +28 -0
  75. data/webpack/JobWizard/steps/Schedule/RepeatOn.js +1 -1
  76. data/webpack/JobWizard/steps/form/Formatter.js +18 -3
  77. data/webpack/JobWizard/steps/form/GroupedSelectField.js +7 -1
  78. data/webpack/__mocks__/foremanReact/components/Pagination.js +2 -0
  79. data/webpack/__mocks__/foremanReact/constants.js +1 -0
  80. data/webpack/global_index.js +4 -0
  81. data/webpack/react_app/components/FeaturesDropdown/actions.js +13 -0
  82. data/webpack/react_app/components/FeaturesDropdown/constant.js +2 -0
  83. data/webpack/react_app/components/FeaturesDropdown/index.js +74 -0
  84. data/webpack/react_app/components/HostKebab/KebabItems.js +22 -0
  85. data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +6 -1
  86. data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
  87. data/webpack/react_app/components/RecentJobsCard/constants.js +1 -0
  88. data/webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js +1 -1
  89. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +1 -6
  90. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -9
  91. data/webpack/react_app/components/TargetingHosts/index.js +2 -3
  92. data/webpack/react_app/extend/fillKebabItems.js +11 -0
  93. data/webpack/react_app/extend/fillRexFeaturesDropdown.js +11 -0
  94. metadata +24 -16
  95. data/app/views/templates/README.md +0 -6
  96. 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: 831ec5aca2ec4aaa3df1229f7addd9a968c7c49b0fc49a15253e33d2ab0f5689
4
- data.tar.gz: 07a4f17f0d4d694c4b927291ee8e55dafd839cf902a9ef06c79b227fdf65760f
3
+ metadata.gz: 71b09dd41d7ce39e709e4a45c2c78926d53151ed3625fcf2f4e0d739853cae8e
4
+ data.tar.gz: d01463507ceb52b52f661fa9a55ce413e2f824d74dfe50958063359f5a6fa8e9
5
5
  SHA512:
6
- metadata.gz: 75fd11cfe45b5223a2427561c0859c39f19923535283fa919927af9b4ffd67ea56a4c9b791632e73c72c4dff1946f2e1046cb10a1f84ed7dae0e686daff2d90d
7
- data.tar.gz: 03557c309e25a902c0def6e7575ad74a02e724482da823b4580f4bbe9b80358eadb2e0781b832f45a2e9101196447edf887476fa79782a3d6ee125640dccd92a
6
+ metadata.gz: 2840a0f11ef02ba63f3a981075eae66e50e5fa0f7738518c3bf3a74f0bf5b7cf6be3273c2ebb999d00174244fb73295b3d0f8c74b663ef9839a91a16ad9c9878
7
+ data.tar.gz: 79a0dad8442b9135995a8bcbf62dfde4e112cd765950b61f45db0c490eac0d21e3cf843aea946c2450f69ab8f4d098fe26927b4eafe4cd0b7d6a1097ba04ceb9
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
@@ -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 authorized_for(controller: :job_invocations, action: :new)
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(*args)
26
- return unless authorized_for(controller: :job_invocations, action: :create)
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 => [args.first.id], :feature => feature.label), :method => :post)
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(*args)
33
- return unless authorized_for(controller: :job_invocations, action: :new)
34
- link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button, :class => 'btn btn-default')
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 unless authorized_for(permission: 'cockpit_hosts', auth_object: host)
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
@@ -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
@@ -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: host_path(host), 'data-method': 'get', id: "#{host.name}-actions-detail" } }
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)
@@ -40,7 +40,7 @@ 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
45
  link!(proxy)
46
46
  input[:proxy_id] = proxy.id
@@ -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
@@ -98,7 +102,7 @@ module ForemanRemoteExecution
98
102
  end
99
103
 
100
104
  def remote_execution_ssh_keys
101
- remote_execution_proxies('SSH', false).values.flatten.uniq.map { |proxy| proxy.pubkey }.compact.uniq
105
+ remote_execution_proxies(%w(SSH Script), false).values.flatten.uniq.map { |proxy| proxy.pubkey }.compact.uniq
102
106
  end
103
107
 
104
108
  def drop_execution_interface_cache
@@ -121,6 +125,10 @@ module ForemanRemoteExecution
121
125
  @cached_rex_host_params_hash = nil
122
126
  end
123
127
 
128
+ def infrastructure_host?
129
+ infrastructure_facet&.foreman_instance || infrastructure_facet&.smart_proxy_id
130
+ end
131
+
124
132
  private
125
133
 
126
134
  def extend_host_params_hash(params)
@@ -3,16 +3,18 @@ module ForemanRemoteExecution
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- before_validation :set_execution_flag
7
6
  validate :exclusive_execution_interface
7
+ before_validation :move_execution_flag
8
8
  end
9
9
 
10
10
  private
11
11
 
12
- def set_execution_flag
13
- return unless primary? && host.present?
12
+ def move_execution_flag
13
+ return unless host && self.execution?
14
14
 
15
- self.execution = true if host.interfaces.detect(&:execution).nil?
15
+ host.interfaces
16
+ .select { |i| i.execution? && i != self }
17
+ .each { |i| i.execution = false }
16
18
  end
17
19
 
18
20
  def exclusive_execution_interface
@@ -11,7 +11,7 @@ module ForemanRemoteExecution
11
11
  end
12
12
 
13
13
  def update_pubkey
14
- return unless has_feature?('SSH')
14
+ return unless has_feature?(%w(SSH Script))
15
15
 
16
16
  key = ::ProxyAPI::RemoteExecutionSSH.new(:url => url).pubkey
17
17
  self.update_attribute(:pubkey, key) if key
@@ -217,7 +217,7 @@ class JobInvocationComposer
217
217
  def format_datetime(datetime)
218
218
  return datetime if datetime.blank?
219
219
 
220
- Time.parse(datetime).utc.strftime('%Y-%m-%d %H:%M')
220
+ Time.parse(datetime).in_time_zone.strftime('%Y-%m-%d %H:%M')
221
221
  end
222
222
  end
223
223
 
@@ -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?
@@ -37,8 +37,7 @@ class SSHExecutionProvider < RemoteExecutionProvider
37
37
  end
38
38
 
39
39
  def ssh_params(host)
40
- proxy_selector = ::RemoteExecutionProxySelector.new
41
- proxy = proxy_selector.determine_proxy(host, 'SSH')
40
+ proxy = proxy_for_cockpit(host)
42
41
  {
43
42
  :hostname => find_ip_or_hostname(host),
44
43
  :proxy => proxy.class == Symbol ? proxy : proxy.url,
@@ -53,6 +52,10 @@ class SSHExecutionProvider < RemoteExecutionProvider
53
52
  Setting[:remote_execution_cockpit_url] % { :host => host } if Setting[:remote_execution_cockpit_url].present?
54
53
  end
55
54
 
55
+ def proxy_feature
56
+ %w(SSH Script)
57
+ end
58
+
56
59
  private
57
60
 
58
61
  def ssh_user(host)
@@ -62,5 +65,15 @@ class SSHExecutionProvider < RemoteExecutionProvider
62
65
  def ssh_port(host)
63
66
  Integer(host_setting(host, :remote_execution_ssh_port))
64
67
  end
68
+
69
+ def proxy_for_cockpit(host)
70
+ proxy_selector = ::RemoteExecutionProxySelector.new
71
+ proxy = proxy_selector.determine_proxy(host, 'Script', capability: 'cockpit')
72
+ return proxy unless [:not_defined, :not_available, nil].include?(proxy)
73
+
74
+ proxy_selector.determine_proxy(host, 'SSH')
75
+ end
65
76
  end
66
77
  end
78
+
79
+ SSHExecutionProvider = ScriptExecutionProvider
@@ -67,7 +67,7 @@ class Targeting < ApplicationRecord
67
67
  return '' if ids.empty?
68
68
 
69
69
  hosts = Host.execution_scope.where(:id => ids).distinct.pluck(:name)
70
- "name ^ (#{hosts.join(', ')})"
70
+ hosts.any? ? "name ^ (#{hosts.join(', ')})" : ''
71
71
  end
72
72
 
73
73
  def resolved?
@@ -7,7 +7,7 @@ class DefaultProxyProxySelector < ::RemoteExecutionProxySelector
7
7
  super
8
8
  end
9
9
 
10
- def available_proxies(host, provider)
10
+ def available_proxies(host, provider, capability: nil)
11
11
  # TODO: Once we have a internal proxy marker/feature on the proxy, we can
12
12
  # swap the implementation
13
13
  raise _('default_capsule method missing from SmartProxy') unless ::SmartProxy.respond_to?(:default_capsule)
@@ -2,7 +2,12 @@ class RemoteExecutionProxySelector < ::ForemanTasks::ProxySelector
2
2
 
3
3
  INTERNAL_PROXY = 'internal'.freeze
4
4
 
5
- def available_proxies(host, provider)
6
- host.remote_execution_proxies(provider)
5
+ def available_proxies(host, provider, capability: nil)
6
+ proxies = host.remote_execution_proxies(provider)
7
+ return proxies if capability.nil?
8
+
9
+ proxies.reduce({}) do |acc, (strategy, possible_proxies)|
10
+ acc.merge(strategy => possible_proxies.select { |proxy| proxy.has_capability?(capability) })
11
+ end
7
12
  end
8
13
  end
@@ -0,0 +1 @@
1
+ attributes :cockpit_url
@@ -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), host_path(host), :target => '_blank' %></li>
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, host_path(@host)) %>
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 %>
@@ -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
@@ -69,8 +69,11 @@ handle_zypp_res_codes () {
69
69
 
70
70
  if [ "${ZYPP_RES_CODES[$RETVAL]}" != "" ]; then
71
71
  echo ${ZYPP_RES_CODES[$RETVAL]}
72
+ fi
73
+ if [[ $RETVAL -ge 100 && $RETVAL -le 103 ]]; then
72
74
  RETVAL=0
73
75
  fi
76
+
74
77
  return $RETVAL
75
78
  }
76
79
  <% end -%>
@@ -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
@@ -1,2 +1,5 @@
1
1
  f = Feature.where(:name => 'SSH').first_or_create
2
2
  raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
3
+
4
+ f = Feature.where(:name => 'Script').first_or_create
5
+ raise "Unable to create proxy feature: #{format_errors f}" if f.nil? || f.errors.any?
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
+ }