foreman_remote_execution 18.0.0 → 18.1.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 (121) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +54 -9
  3. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +54 -9
  4. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +54 -9
  5. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +66 -21
  6. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +86 -41
  7. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +111 -66
  8. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +67 -22
  9. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +54 -9
  10. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +54 -9
  11. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +60 -15
  12. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +54 -9
  13. data/app/assets/javascripts/foreman_remote_execution/template_invocation.js +0 -170
  14. data/app/assets/stylesheets/foreman_remote_execution/job_invocations.scss +0 -6
  15. data/app/controllers/job_invocations_controller.rb +1 -98
  16. data/app/helpers/job_invocations_helper.rb +0 -49
  17. data/app/helpers/remote_execution_helper.rb +23 -123
  18. data/app/models/remote_execution_provider.rb +1 -1
  19. data/config/routes.rb +0 -6
  20. data/lib/foreman_remote_execution/plugin.rb +2 -2
  21. data/lib/foreman_remote_execution/version.rb +1 -1
  22. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  23. data/locale/de/foreman_remote_execution.po +54 -9
  24. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  25. data/locale/en_GB/foreman_remote_execution.po +54 -9
  26. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  27. data/locale/es/foreman_remote_execution.po +54 -9
  28. data/locale/foreman_remote_execution.pot +296 -230
  29. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  30. data/locale/fr/foreman_remote_execution.po +66 -21
  31. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  32. data/locale/ja/foreman_remote_execution.po +86 -41
  33. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  34. data/locale/ka/foreman_remote_execution.po +111 -66
  35. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  36. data/locale/ko/foreman_remote_execution.po +67 -22
  37. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  38. data/locale/pt_BR/foreman_remote_execution.po +54 -9
  39. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  40. data/locale/ru/foreman_remote_execution.po +54 -9
  41. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  42. data/locale/zh_CN/foreman_remote_execution.po +60 -15
  43. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  44. data/locale/zh_TW/foreman_remote_execution.po +54 -9
  45. data/package.json +1 -14
  46. data/test/functional/job_invocations_controller_test.rb +0 -77
  47. data/test/unit/remote_execution_provider_test.rb +1 -1
  48. data/webpack/JobInvocationDetail/JobInvocationConstants.js +5 -0
  49. data/webpack/JobInvocationDetail/JobInvocationToolbarButtons.js +0 -10
  50. data/webpack/JobInvocationDetail/TemplateInvocation.js +12 -69
  51. data/webpack/JobInvocationDetail/TemplateInvocationComponents/OutputCodeBlock.js +94 -72
  52. data/webpack/JobInvocationDetail/TemplateInvocationHelpers.js +33 -0
  53. data/webpack/JobInvocationDetail/__tests__/JobInvocationDetailEmptyState.test.js +1 -1
  54. data/webpack/JobInvocationDetail/__tests__/MainInformation.test.js +0 -6
  55. data/webpack/JobInvocationDetail/__tests__/OutputCodeBlock.test.js +1 -1
  56. data/webpack/JobInvocationDetail/__tests__/TableToolbarActions.test.js +1 -1
  57. data/webpack/JobInvocationDetail/__tests__/TemplateInvocation.test.js +5 -1
  58. data/webpack/JobInvocationDetail/__tests__/TemplateInvocationHelpers.test.js +94 -0
  59. data/webpack/JobInvocationDetail/__tests__/TemplateInvocationPolling.test.js +338 -139
  60. data/webpack/JobInvocationDetail/useTemplateInvocationOutputPolling.js +185 -0
  61. data/webpack/JobWizard/JobWizardPageRerun.js +0 -10
  62. data/webpack/JobWizard/__tests__/autofill.test.js +23 -0
  63. data/webpack/JobWizard/__tests__/integration.test.js +1 -1
  64. data/webpack/JobWizard/autofill.js +18 -4
  65. data/webpack/JobWizard/index.js +1 -18
  66. data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +49 -1
  67. data/webpack/global_index.js +0 -2
  68. data/webpack/index.js +0 -15
  69. data/webpack/react_app/components/RegistrationExtension/__tests__/RexInterface.test.js +1 -1
  70. metadata +6 -53
  71. data/app/assets/stylesheets/foreman_remote_execution/modal_window.scss +0 -4
  72. data/app/helpers/job_invocations_chart_helper.rb +0 -80
  73. data/app/views/job_invocations/_card_results.html.erb +0 -12
  74. data/app/views/job_invocations/_card_schedule.html.erb +0 -33
  75. data/app/views/job_invocations/_card_target_hosts.html.erb +0 -57
  76. data/app/views/job_invocations/_card_user_input.html.erb +0 -16
  77. data/app/views/job_invocations/_description_fields.html.erb +0 -4
  78. data/app/views/job_invocations/_form.html.erb +0 -144
  79. data/app/views/job_invocations/_preview_hosts_modal.html.erb +0 -15
  80. data/app/views/job_invocations/_rerun_taxonomies.html.erb +0 -22
  81. data/app/views/job_invocations/_tab_hosts.html.erb +0 -11
  82. data/app/views/job_invocations/_tab_overview.html.erb +0 -41
  83. data/app/views/job_invocations/_tab_preview_templates.html.erb +0 -20
  84. data/app/views/job_invocations/_user_input.html.erb +0 -21
  85. data/app/views/job_invocations/new.html.erb +0 -9
  86. data/app/views/job_invocations/refresh.js.erb +0 -4
  87. data/app/views/job_invocations/show.html.erb +0 -59
  88. data/app/views/job_invocations/show.js.erb +0 -12
  89. data/app/views/job_invocations/show.json.erb +0 -5
  90. data/test/support/remote_execution_helper.rb +0 -5
  91. data/webpack/react_app/components/TargetingHosts/TargetingHosts.js +0 -62
  92. data/webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js +0 -2
  93. data/webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js +0 -10
  94. data/webpack/react_app/components/TargetingHosts/TargetingHostsLabelsRow.js +0 -45
  95. data/webpack/react_app/components/TargetingHosts/TargetingHostsLabelsRow.scss +0 -30
  96. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +0 -78
  97. data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.scss +0 -3
  98. data/webpack/react_app/components/TargetingHosts/TargetingHostsSelectors.js +0 -25
  99. data/webpack/react_app/components/TargetingHosts/__tests__/HostItem.test.js +0 -76
  100. data/webpack/react_app/components/TargetingHosts/__tests__/HostStatus.test.js +0 -6
  101. data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHosts.test.js +0 -6
  102. data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsPage.test.js +0 -9
  103. data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsSelectors.test.js +0 -31
  104. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostStatus.test.js.snap +0 -12
  105. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap +0 -96
  106. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +0 -75
  107. data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsSelectors.test.js.snap +0 -16
  108. data/webpack/react_app/components/TargetingHosts/__tests__/fixtures.js +0 -56
  109. data/webpack/react_app/components/TargetingHosts/components/HostItem.js +0 -39
  110. data/webpack/react_app/components/TargetingHosts/components/HostStatus.js +0 -54
  111. data/webpack/react_app/components/TargetingHosts/index.js +0 -150
  112. data/webpack/react_app/components/jobInvocations/AggregateStatus/index.js +0 -60
  113. data/webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js +0 -76
  114. data/webpack/react_app/components/jobInvocations/index.js +0 -94
  115. data/webpack/react_app/extend/reducers.js +0 -5
  116. data/webpack/react_app/redux/actions/jobInvocations/index.js +0 -87
  117. data/webpack/react_app/redux/consts.js +0 -5
  118. data/webpack/react_app/redux/reducers/index.js +0 -6
  119. data/webpack/react_app/redux/reducers/jobInvocations/index.fixtures.js +0 -46
  120. data/webpack/react_app/redux/reducers/jobInvocations/index.js +0 -34
  121. data/webpack/react_app/redux/reducers/jobInvocations/index.test.js +0 -43
@@ -1,56 +1,8 @@
1
1
  class JobInvocationsController < ApplicationController
2
2
  include ::Foreman::Controller::AutoCompleteSearch
3
3
  include ::ForemanTasks::Concerns::Parameters::Triggering
4
- include ::JobInvocationsChartHelper
5
4
  include RemoteExecutionHelper
6
5
 
7
- def new
8
- return @composer = prepare_composer if params[:feature].present?
9
-
10
- ui_params = {
11
- :host_ids => params[:host_ids],
12
- :targeting => {
13
- :targeting_type => Targeting::STATIC_TYPE,
14
- :bookmark_id => params[:bookmark_id],
15
- },
16
- }
17
- # replace an empty string search with a dummy search query to match all hosts
18
- # but only if search query was entered (based on presence of :search parameter)
19
- if params.key?(:search)
20
- query = params[:search].empty? ? "name != ''" : params[:search]
21
- ui_params[:targeting].update(:search_query => query)
22
- end
23
-
24
- if (template = JobTemplate.find_by(id: params[:template_id]))
25
- ui_params[:job_invocation] = {
26
- :job_category => template.job_category,
27
- :providers => {
28
- template.provider_type => {:job_template_id => template.id},
29
- },
30
- }
31
- end
32
-
33
- @composer = JobInvocationComposer.from_ui_params(ui_params)
34
- end
35
-
36
- def rerun
37
- job_invocation = resource_base.find(params[:id])
38
- @composer = JobInvocationComposer.from_job_invocation(job_invocation, params)
39
- @job_organization = Taxonomy.find_by(id: job_invocation.task.input[:current_organization_id])
40
- @job_location = Taxonomy.find_by(id: job_invocation.task.input[:current_location_id])
41
- render :action => 'new'
42
- end
43
-
44
- def legacy_create
45
- @composer = prepare_composer
46
- if @composer.trigger
47
- redirect_to job_invocation_path(@composer.job_invocation)
48
- else
49
- @composer.job_invocation.description_format = nil if params.fetch(:job_invocation, {}).key?(:description_override)
50
- render :action => 'new'
51
- end
52
- end
53
-
54
6
  def create
55
7
  @composer = prepare_composer
56
8
  if @composer.trigger
@@ -60,46 +12,10 @@ class JobInvocationsController < ApplicationController
60
12
  end
61
13
  end
62
14
 
63
- def show
64
- @job_invocation = resource_base.includes(:template_invocations => :run_host_job_task).find(params[:id])
65
- @job_organization = Taxonomy.find_by(id: @job_invocation.task.input[:current_organization_id])
66
- @job_location = Taxonomy.find_by(id: @job_invocation.task.input[:current_location_id])
67
- @auto_refresh = @job_invocation.task.try(:pending?)
68
-
69
- respond_to do |format|
70
- format.json do
71
- targeting_hosts_resources
72
- end
73
-
74
- format.html
75
- format.js
76
- end
77
- end
78
-
79
15
  def index
80
16
  @job_invocations = resource_base_search_and_page.preload(:task, :targeting).order('job_invocations.id DESC')
81
17
  end
82
18
 
83
- # refreshes the form
84
- def refresh
85
- params[:job_invocation].delete :description_format if params[:job_invocation].key?(:description_override)
86
- @composer = prepare_composer
87
- end
88
-
89
- def chart
90
- find_resource
91
- render :json => {
92
- :finished => @job_invocation.finished?,
93
- :job_invocations => job_invocation_data(@job_invocation)[:columns],
94
- :statuses => {
95
- :success => @job_invocation.progress_report[:success],
96
- :cancelled => @job_invocation.progress_report[:cancelled],
97
- :failed => @job_invocation.progress_report[:error],
98
- :pending => @job_invocation.progress_report[:pending],
99
- },
100
- }
101
- end
102
-
103
19
  def preview_hosts
104
20
  composer = prepare_composer
105
21
 
@@ -168,13 +84,11 @@ class JobInvocationsController < ApplicationController
168
84
 
169
85
  def action_permission
170
86
  case params[:action]
171
- when 'rerun'
172
- 'create'
173
87
  when 'preview_hosts'
174
88
  'create'
175
89
  when 'cancel'
176
90
  'cancel'
177
- when 'chart', 'preview_job_invocations_per_host', 'report'
91
+ when 'preview_job_invocations_per_host', 'report'
178
92
  'view'
179
93
  else
180
94
  super
@@ -199,15 +113,4 @@ class JobInvocationsController < ApplicationController
199
113
  end
200
114
  end
201
115
 
202
- def targeting_hosts_resources
203
- @auto_refresh = @job_invocation.task.try(:pending?)
204
- @resource_base = @job_invocation.targeting.hosts.authorized(:view_hosts, Host)
205
-
206
- unless params[:search].nil?
207
- @resource_base = @resource_base.joins(:template_invocations)
208
- .where(:template_invocations => { :job_invocation_id => @job_invocation.id})
209
- end
210
- @hosts = resource_base_search_and_page
211
- @total_hosts = resource_base_with_search.size
212
- end
213
116
  end
@@ -1,55 +1,6 @@
1
1
  # frozen_string_literal:true
2
2
 
3
3
  module JobInvocationsHelper
4
- def minicard(icon, number, text, tooltip: nil)
5
- tooltip_options = tooltip ? { :'data-original-title' => tooltip, :rel => 'twipsy' } : {}
6
- content_tag(:div, :class => 'card-pf card-pf-accented
7
- card-pf-aggregate-status card-pf-aggregate-status-mini') do
8
- content_tag(:h2, { :class => 'card-pf-title', :style => 'line-height: 1.1' }.merge(tooltip_options)) do
9
- icon_text(icon, '', :kind => 'pficon') +
10
- content_tag(:span, number, :class =>'card-pf-aggregate-status-count') +
11
- text
12
- end
13
- end
14
- end
15
-
16
- def template_name_and_provider_link(template)
17
- template_name = content_tag(:strong, template.name)
18
- provider = template.provider.humanized_name
19
- link_content = template_name + ' - ' + provider + ' ' +
20
- icon_text('edit', '', :kind => 'pficon')
21
- link_to_if_authorized(link_content,
22
- hash_for_edit_job_template_path(:id => template.id))
23
- end
24
-
25
- def preview_hosts(template_invocation)
26
- hosts = template_invocation.targeting.hosts.authorized(:view_hosts, Host).take(20)
27
- hosts.map do |host|
28
- collapsed_preview(host) +
29
- render(:partial => 'job_invocations/user_input',
30
- :locals => { :template_invocation => template_invocation,
31
- :target => host })
32
- end.reduce(:+)
33
- end
34
-
35
- def collapsed_preview(target)
36
- title = (target || 'N/A').to_s
37
- content_tag(:h5,
38
- :class => "expander collapsed out",
39
- :data => { :toggle => 'collapse',
40
- :target => "#preview_#{target.id}" }) do
41
- content_tag(:span, '', :class => 'caret') + title
42
- end
43
- end
44
-
45
- def show_job_organization(organization)
46
- organization.presence || _('Any Organization')
47
- end
48
-
49
- def show_job_location(location)
50
- location.presence || _('Any Location')
51
- end
52
-
53
4
  def input_safe_value(input)
54
5
  template_input = input.template_input
55
6
  template_input.respond_to?(:hidden_value) && template_input.hidden_value ? '*' * 5 : input.value
@@ -3,20 +3,6 @@ module RemoteExecutionHelper
3
3
  RemoteExecutionProvider.providers.reject { |key, _provider| key == 'SSH' }.map { |key, provider| [ key, _(provider.humanized_name) ] }
4
4
  end
5
5
 
6
- def job_hosts_authorizer
7
- @job_hosts_authorizer ||= Authorizer.new(User.current, :collection => @hosts)
8
- end
9
-
10
- def host_tasks_authorizer
11
- @host_tasks_authorizer ||= Authorizer.new(User.current, :collection => @job_invocation.sub_tasks)
12
- end
13
-
14
- def host_counter(label, count)
15
- content_tag(:div, :class => 'host_counter') do
16
- content_tag(:div, label, :class => 'header') + content_tag(:div, count.to_s, :class => 'count')
17
- end
18
- end
19
-
20
6
  def template_invocation_status(task, parent_task)
21
7
  return(parent_task.result == 'cancelled' ? 'cancelled' : 'N/A') if task.nil?
22
8
  return task.state if task.state == 'running' || task.state == 'planned'
@@ -25,33 +11,6 @@ module RemoteExecutionHelper
25
11
  task.result
26
12
  end
27
13
 
28
- def template_invocation_actions(task, host, job_invocation, template_invocation)
29
- links = []
30
- host_task = template_invocation.try(:run_host_job_task)
31
-
32
- if authorized_for(hash_for_host_path(host).merge(auth_object: host, permission: :view_hosts, authorizer: job_hosts_authorizer))
33
- links << { title: _('Host detail'),
34
- action: { href: current_host_details_path(host), 'data-method': 'get', id: "#{host.name}-actions-detail" } }
35
- end
36
- if authorized_for(controller: :job_invocations, action: :create) && (!host.infrastructure_host? || User.current.can?(:execute_jobs_on_infrastructure_hosts))
37
- links << { title: (_('Rerun on %s') % host),
38
- action: { href: rerun_job_invocation_path(job_invocation, host_ids: [ host.id ]),
39
- 'data-method': 'get', id: "#{host.name}-actions-rerun" } }
40
- end
41
-
42
- if host_task.present? && authorized_for(hash_for_foreman_tasks_task_path(host_task).merge(auth_object: host_task, permission: :view_foreman_tasks, authorizer: host_tasks_authorizer))
43
- links << { title: _('Host task'),
44
- action: { href: foreman_tasks_task_path(host_task),
45
- 'data-method': 'get', id: "#{host.name}-actions-task" } }
46
- end
47
-
48
- links
49
- end
50
-
51
- def remote_execution_provider_for(template_invocation)
52
- template_invocation.nil? ? _('N/A') : template_invocation.template.provider.humanized_name
53
- end
54
-
55
14
  def job_invocations_buttons
56
15
  [
57
16
  documentation_button('Managing_Hosts', type: 'docs', chapter: 'executing-a-remote-job_managing-hosts'),
@@ -59,53 +18,6 @@ module RemoteExecutionHelper
59
18
  ]
60
19
  end
61
20
 
62
- def job_invocation_task_buttons(task)
63
- job_invocation = task.task_groups.find { |group| group.class == JobInvocationTaskGroup }.job_invocation
64
- task_authorizer = Authorizer.new(User.current, :collection => [task])
65
- buttons = []
66
- if (template = job_report_template) && authorized_for(controller: :report_templates, action: :generate)
67
- buttons << link_to(_('Create Report'), generate_report_template_path(template, job_report_template_parameters(job_invocation, template)),
68
- class: 'btn btn-default',
69
- title: _('Create report for this job'),
70
- disabled: task.pending?)
71
- end
72
- if authorized_for(controller: :job_invocations, action: :create)
73
- buttons << link_to(_('Rerun'), rerun_job_invocation_path(:id => job_invocation.id),
74
- :class => 'btn btn-default',
75
- :title => _('Rerun the job'))
76
- buttons << link_to(_('Rerun failed'), rerun_job_invocation_path(:id => job_invocation.id, :failed_only => 1),
77
- :class => 'btn btn-default',
78
- :disabled => job_invocation.failed_hosts.none?,
79
- :title => _('Rerun on failed hosts'))
80
- buttons << link_to(_('Rerun succeeded'), rerun_job_invocation_path(:id => job_invocation.id, :succeeded_only => 1),
81
- :class => 'btn btn-default',
82
- :disabled => job_invocation.succeeded_hosts.none?,
83
- :title => _('Rerun on succeeded hosts'))
84
- end
85
- if authorized_for(:permission => :view_foreman_tasks, :auth_object => task, :authorizer => task_authorizer)
86
- buttons << link_to(_('Job Task'), foreman_tasks_task_path(task),
87
- :class => 'btn btn-default',
88
- :title => _('See the last task details'))
89
- end
90
- if authorized_for(:permission => :cancel_job_invocations, :auth_object => job_invocation)
91
- buttons << button_to(_('Cancel Job'), cancel_job_invocation_path(job_invocation),
92
- :class => 'btn btn-danger',
93
- :title => _('Try to cancel the job'),
94
- :disabled => !task.cancellable?,
95
- :method => :post)
96
- buttons << button_to(_('Abort Job'), cancel_job_invocation_path(job_invocation, :force => true),
97
- :class => 'btn btn-danger',
98
- :title => _('Try to abort the job without waiting for the results from the remote hosts'),
99
- :disabled => !task.cancellable?,
100
- :method => :post)
101
- end
102
- buttons << link_to(_('New UI'), job_invocation_path(:id => job_invocation.id),
103
- class: 'btn btn-default',
104
- title: _('Switch to the new job invocation detail UI'))
105
-
106
- buttons
107
- end
108
-
109
21
  def template_invocation_task_buttons(task, invocation)
110
22
  buttons = []
111
23
  if authorized_for(:permission => :view_foreman_tasks, :auth_object => task)
@@ -130,8 +42,30 @@ module RemoteExecutionHelper
130
42
  buttons
131
43
  end
132
44
 
45
+ def job_invocation_status(invocation, percent = nil, verbose: true)
46
+ case invocation.status
47
+ when HostStatus::ExecutionStatus::QUEUED
48
+ if verbose && invocation.task
49
+ _('queued to start executing in %{time}') % {:time => time_ago_in_words(invocation.task.start_at) }
50
+ else
51
+ _('queued')
52
+ end
53
+ when HostStatus::ExecutionStatus::RUNNING
54
+ percent ||= invocation.progress_report[:progress]
55
+ _('running %{percent}%%') % {:percent => percent}
56
+ when HostStatus::ExecutionStatus::OK
57
+ _('succeeded')
58
+ when HostStatus::ExecutionStatus::CANCELLED
59
+ _('cancelled')
60
+ when HostStatus::ExecutionStatus::ERROR
61
+ _('failed')
62
+ else
63
+ _('unknown status')
64
+ end
65
+ end
66
+
133
67
  def link_to_invocation_task_if_authorized(invocation)
134
- status = job_invocation_status(invocation, nil, false)
68
+ status = job_invocation_status(invocation, nil, verbose: false)
135
69
  if invocation.queued?
136
70
  status
137
71
  else
@@ -207,27 +141,6 @@ module RemoteExecutionHelper
207
141
  end
208
142
  end
209
143
 
210
- def description_checkbox_f(f, job_template, disabled)
211
- check_box_tag('description_format_override',
212
- job_template.generate_description_format,
213
- f.object.description_format.nil?,
214
- :class => 'description_format_override',
215
- :name => f.object_name + '[description_override]',
216
- :disabled => disabled,
217
- :onchange => 'description_override(this);') + ' ' + _('Use default description template')
218
- end
219
-
220
- def description_format_textarea_f(f, job_template, disabled)
221
- textarea_f f, 'description_format',
222
- :label => _('Description template'),
223
- :value => f.object.description_format || job_template.generate_description_format,
224
- :rows => 2,
225
- :onchange => 'regenerate_description(this);',
226
- :class => 'description_format advanced',
227
- :disabled => disabled,
228
- :label_help => description_format_help
229
- end
230
-
231
144
  def description_format_help
232
145
  _('This template is used to generate the description.<br/>' +
233
146
  'Input values can be used using the syntax %{package}.<br/>' +
@@ -262,17 +175,4 @@ module RemoteExecutionHelper
262
175
  },
263
176
  }
264
177
  end
265
-
266
- def targeting_hosts(job_invocation, hosts)
267
- hosts.map do |host|
268
- template_invocation = job_invocation.template_invocations.find { |template_inv| template_inv.host_id == host.id }
269
- task = template_invocation.try(:run_host_job_task)
270
- link_authorized = !task.nil? && authorized_for(hash_for_template_invocation_path(:id => template_invocation).merge(:auth_object => host, :permission => :view_hosts, :authorizer => job_hosts_authorizer))
271
-
272
- { name: host.to_label,
273
- link: link_authorized ? template_invocation_path(:id => template_invocation) : '',
274
- status: template_invocation_status(task, job_invocation.task),
275
- actions: template_invocation_actions(task, host, job_invocation, template_invocation) }
276
- end
277
- end
278
178
  end
@@ -59,7 +59,7 @@ class RemoteExecutionProvider
59
59
  end
60
60
 
61
61
  def effective_user(template_invocation)
62
- template_invocation.effective_user
62
+ template_invocation.effective_user.shellescape
63
63
  end
64
64
 
65
65
  def effective_user_method(host)
data/config/routes.rb CHANGED
@@ -18,19 +18,13 @@ Rails.application.routes.draw do
18
18
 
19
19
  match 'job_invocations/new', to: 'react#index', :via => [:get], as: 'new_job_invocation'
20
20
  match 'job_invocations/new', to: 'job_invocations#create', via: [:post], as: 'create_job_invocation'
21
- match 'job_invocations/', to: 'job_invocations#legacy_create', via: [:post], as: 'legacy_create_job_invocation'
22
21
  match 'job_invocations/:id/rerun', to: 'react#index', :via => [:get], as: 'rerun_job_invocation'
23
- match 'old/job_invocations/new', to: 'job_invocations#new', via: [:get], as: 'form_new_job_invocation'
24
- match 'old/job_invocations/:id/rerun', to: 'job_invocations#rerun', via: [:get, :post], as: 'form_rerun_job_invocation'
25
- get 'legacy/job_invocations/:id', to: 'job_invocations#show', as: 'legacy_job_invocation'
26
22
  match 'job_invocations_detail/:id/host_invocation/:host_id', to: 'react#index', :via => [:get], as: 'new_job_invocation_detail_by_host'
27
23
  get 'show_template_invocation_by_host/:host_id/job_invocation/:id', to: 'template_invocations#show_template_invocation_by_host'
28
24
 
29
25
  resources :job_invocations, :only => [:create, :index] do
30
26
  collection do
31
27
  get 'preview_job_invocations_per_host'
32
- post 'refresh'
33
- get 'chart'
34
28
  get 'preview_hosts'
35
29
  get 'auto_complete_search'
36
30
  end
@@ -141,9 +141,9 @@ Foreman::Plugin.register :foreman_remote_execution do
141
141
  permission :destroy_job_templates, { :job_templates => [:destroy],
142
142
  :'api/v2/job_templates' => [:destroy] }, :resource_type => 'JobTemplate'
143
143
  permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
144
- permission :create_job_invocations, { :job_invocations => [:new, :create, :legacy_create, :refresh, :rerun, :preview_hosts],
144
+ permission :create_job_invocations, { :job_invocations => [:create, :preview_hosts],
145
145
  'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
146
- permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search, :preview_job_invocations_per_host, :report], :template_invocations => [:show, :show_template_invocation_by_host],
146
+ permission :view_job_invocations, { :job_invocations => [:index, :auto_complete_search, :preview_job_invocations_per_host, :report], :template_invocations => [:show, :show_template_invocation_by_host],
147
147
  'api/v2/job_invocations' => [:index, :show, :output, :raw_output, :outputs, :hosts] }, :resource_type => 'JobInvocation'
148
148
  permission :view_template_invocations, { :template_invocations => [:show, :template_invocation_preview, :show_template_invocation_by_host],
149
149
  'api/v2/template_invocations' => [:template_invocations], :ui_job_wizard => [:job_invocation] }, :resource_type => 'TemplateInvocation'
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '18.0.0'.freeze
2
+ VERSION = '18.1.0'.freeze
3
3
  end
@@ -13,7 +13,7 @@
13
13
  # abf90805572190d649c59f7a021d76cb, 2017
14
14
  msgid ""
15
15
  msgstr ""
16
- "Project-Id-Version: foreman_remote_execution 16.5.1\n"
16
+ "Project-Id-Version: foreman_remote_execution 18.0.0\n"
17
17
  "Report-Msgid-Bugs-To: \n"
18
18
  "PO-Revision-Date: 2016-02-15 13:54+0000\n"
19
19
  "Last-Translator: Adam Růžička <aruzicka@redhat.com>, 2026\n"
@@ -140,6 +140,9 @@ msgstr ""
140
140
  msgid "Alphabetical"
141
141
  msgstr "Alphabetisch"
142
142
 
143
+ msgid "Already on the review step"
144
+ msgstr ""
145
+
143
146
  msgid "An error occurred while fetching the template invocation details."
144
147
  msgstr ""
145
148
 
@@ -269,28 +272,28 @@ msgstr "Parallelitätsebene und zeitliche Verteilung steuern"
269
272
  msgid "Copy to clipboard"
270
273
  msgstr ""
271
274
 
272
- msgid "Could not abort the job %s: ${response}"
275
+ msgid "Could not abort the job %s: %s"
273
276
  msgstr ""
274
277
 
275
278
  msgid "Could not abort the task"
276
279
  msgstr ""
277
280
 
278
- msgid "Could not cancel recurring logic %s: ${response}"
281
+ msgid "Could not cancel recurring logic %s: %s"
279
282
  msgstr ""
280
283
 
281
- msgid "Could not cancel the job %s: ${response}"
284
+ msgid "Could not cancel the job %s: %s"
282
285
  msgstr ""
283
286
 
284
287
  msgid "Could not cancel the task"
285
288
  msgstr ""
286
289
 
287
- msgid "Could not disable recurring logic %s: ${response}"
290
+ msgid "Could not disable recurring logic %s: %s"
288
291
  msgstr ""
289
292
 
290
293
  msgid "Could not display data for job invocation."
291
294
  msgstr "Daten für Jobaufruf konnten nicht angezeigt werden."
292
295
 
293
- msgid "Could not enable recurring logic %s: ${response}"
296
+ msgid "Could not enable recurring logic %s: %s"
294
297
  msgstr ""
295
298
 
296
299
  msgid "Could not find any suitable interface for execution"
@@ -323,6 +326,9 @@ msgstr "Neuen Auftragsaufruf erstellen"
323
326
  msgid "Create a job template"
324
327
  msgstr "Auftragsvorlage erstellen"
325
328
 
329
+ msgid "Create a new job invocation"
330
+ msgstr ""
331
+
326
332
  msgid "Create a recurring job"
327
333
  msgstr "Wiederkehrenden Auftrag erstellen"
328
334
 
@@ -413,6 +419,9 @@ msgstr "Beschreibungsvorlage"
413
419
  msgid "Designation of a special purpose"
414
420
  msgstr ""
415
421
 
422
+ msgid "Directory on the host where remote execution jobs in push mode place and run their scripts. You can override this setting per host with the `remote_execution_remote_working_dir` host parameter."
423
+ msgstr ""
424
+
416
425
  msgid "Disable recurring"
417
426
  msgstr ""
418
427
 
@@ -548,6 +557,9 @@ msgstr ""
548
557
  msgid "Failed rendering template: %s"
549
558
  msgstr "Rendern der Vorlage fehlgeschlagen: %s"
550
559
 
560
+ msgid "Failed to load host invocation data"
561
+ msgstr ""
562
+
551
563
  msgid "Failed:"
552
564
  msgstr ""
553
565
 
@@ -602,6 +614,9 @@ msgstr "Besorge dir die Outputs eines Hosts eines Jobs"
602
614
  msgid "Get raw output for a host"
603
615
  msgstr "Besorge dir die rohen Outputs eines Hosts"
604
616
 
617
+ msgid "Go to job invocations"
618
+ msgstr ""
619
+
605
620
  msgid "Has to be a positive number"
606
621
  msgstr ""
607
622
 
@@ -668,6 +683,12 @@ msgstr ""
668
683
  msgid "Include all inputs from the foreign template"
669
684
  msgstr "Alle Eingaben aus Fremdvorlage einschließen"
670
685
 
686
+ msgid "Include hosts and template invocations in the response. Defaults to true for backwards compatibility. Pass false to skip serializing all hosts."
687
+ msgstr ""
688
+
689
+ msgid "Include per-host task and permission data in the response"
690
+ msgstr ""
691
+
671
692
  msgid "Indicates that the action should be cancelled if it cannot be started before this time."
672
693
  msgstr "Gibt an, dass die Aktion abgebrochen werden soll, wenn sie nicht vor diesem Zeitpunkt gestartet werden kann."
673
694
 
@@ -836,6 +857,9 @@ msgstr "Manuelle Auswahl"
836
857
  msgid "Minute can only be a number between 0-59"
837
858
  msgstr ""
838
859
 
860
+ msgid "Missing permissions to generate report templates"
861
+ msgstr ""
862
+
839
863
  msgid "Missing the required permissions: ${missingPermissions.join( ', ' )}"
840
864
  msgstr ""
841
865
 
@@ -1117,6 +1141,12 @@ msgstr "Label der Remote-Ausführungsfunktion, die ausgelöst werden soll, die d
1117
1141
  msgid "Remote execution job"
1118
1142
  msgstr ""
1119
1143
 
1144
+ msgid "Remote working directory"
1145
+ msgstr ""
1146
+
1147
+ msgid "Remote working directory \"%{current_value}\" is not an absolute path"
1148
+ msgstr ""
1149
+
1120
1150
  msgid "Repeat a maximum of N times"
1121
1151
  msgstr "Maximal n-mal wiederholen"
1122
1152
 
@@ -1129,6 +1159,9 @@ msgstr "Wiederholen bis"
1129
1159
  msgid "Repeats"
1130
1160
  msgstr "Wiederholungen "
1131
1161
 
1162
+ msgid "Report template not found or not configured properly"
1163
+ msgstr ""
1164
+
1132
1165
  msgid "Rerun"
1133
1166
  msgstr "Erneut ausführen"
1134
1167
 
@@ -1324,9 +1357,6 @@ msgstr ""
1324
1357
  msgid "Should this interface be used for remote execution?"
1325
1358
  msgstr "Soll diese Schnittstelle für die Remote-Ausführung verwendet werden?"
1326
1359
 
1327
- msgid "Show Job status for the hosts"
1328
- msgstr "Zeige Job status des Hosts"
1329
-
1330
1360
  msgid "Show all advanced fields"
1331
1361
  msgstr "Alle erweiterten Felder anzeigen"
1332
1362
 
@@ -1336,6 +1366,9 @@ msgstr " Details zu Fremdeingabe-Satz anzeigen"
1336
1366
  msgid "Show job invocation"
1337
1367
  msgstr "Auftragsaufrufe anzeigen"
1338
1368
 
1369
+ msgid "Show job status for each host, only applicable when include_hosts is true"
1370
+ msgstr ""
1371
+
1339
1372
  msgid "Show job template details"
1340
1373
  msgstr "Details der Auftragsvorlage anzeigen"
1341
1374
 
@@ -1650,6 +1683,9 @@ msgstr "Vorlage kann nicht gespeichert werden. Bitte korrigieren Sie die markier
1650
1683
  msgid "Unknown"
1651
1684
  msgstr "Unbekannt"
1652
1685
 
1686
+ msgid "Unknown error."
1687
+ msgstr ""
1688
+
1653
1689
  msgid "Unknown execution status"
1654
1690
  msgstr "Unbekannter Ausführungsstatus"
1655
1691
 
@@ -1797,6 +1833,9 @@ msgstr "hier"
1797
1833
  msgid "host already has an execution interface"
1798
1834
  msgstr "Host verfügt bereits über eine Ausführungsschnittstelle"
1799
1835
 
1836
+ msgid "host method"
1837
+ msgstr ""
1838
+
1800
1839
  msgid "hosts"
1801
1840
  msgstr "Hosts"
1802
1841
 
@@ -1824,6 +1863,12 @@ msgstr "Minute (im Bereich: 0-59)"
1824
1863
  msgid "is month (range: 1-12)"
1825
1864
  msgstr "Monat (im Bereich: 1-12)"
1826
1865
 
1866
+ msgid "job invocation"
1867
+ msgstr ""
1868
+
1869
+ msgid "must be an absolute path"
1870
+ msgstr ""
1871
+
1827
1872
  msgid "no"
1828
1873
  msgstr "nein"
1829
1874