foreman_remote_execution 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/job_invocations_controller.rb +1 -0
- data/app/controllers/job_invocations_controller.rb +20 -1
- data/app/controllers/ui_job_wizard_controller.rb +3 -1
- data/app/helpers/remote_execution_helper.rb +1 -1
- data/app/lib/actions/remote_execution/run_host_job.rb +1 -1
- data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
- data/app/views/job_invocations/_form.html.erb +1 -1
- data/app/views/job_invocations/show.html.erb +1 -1
- data/app/views/job_invocations/welcome.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/db/migrate/20210816100932_rex_setting_category_to_dsl.rb +1 -1
- data/lib/foreman_remote_execution/engine.rb +1 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/action_names.rb +2 -2
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +266 -154
- data/locale/en/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en/foreman_remote_execution.po +132 -24
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +149 -41
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +320 -210
- data/locale/foreman_remote_execution.pot +394 -211
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +353 -241
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +368 -261
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +161 -53
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +335 -225
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +161 -53
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +465 -359
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +162 -54
- data/webpack/JobWizard/JobWizard.js +52 -10
- data/webpack/JobWizard/JobWizardConstants.js +1 -1
- data/webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap +8 -0
- data/webpack/JobWizard/__tests__/fixtures.js +5 -0
- data/webpack/JobWizard/__tests__/integration.test.js +15 -0
- data/webpack/JobWizard/__tests__/validation.test.js +27 -0
- data/webpack/JobWizard/autofill.js +1 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +19 -0
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +8 -0
- data/webpack/JobWizard/steps/HostsAndInputs/HostPreviewModal.js +3 -0
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +32 -2
- data/webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js +16 -10
- data/webpack/JobWizard/steps/HostsAndInputs/index.js +51 -3
- data/webpack/JobWizard/steps/Schedule/QueryType.js +1 -1
- data/webpack/JobWizard/steps/Schedule/RepeatHour.js +0 -1
- data/webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js +25 -5
- data/webpack/JobWizard/steps/form/DateTimePicker.js +0 -1
- data/webpack/JobWizard/steps/form/GroupedSelectField.js +0 -1
- data/webpack/JobWizard/steps/form/SelectField.js +0 -1
- data/webpack/JobWizard/submit.js +13 -2
- data/webpack/react_app/components/RecentJobsCard/RecentJobsCard.js +4 -4
- data/webpack/react_app/components/RecentJobsCard/RecentJobsTable.js +2 -2
- data/webpack/react_app/components/RecentJobsCard/constants.js +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674db947b57b16debf5f335beddbd05100ea8c6bd41b9a75a0747e6405da6c77
|
4
|
+
data.tar.gz: 0f822dcd5e109ed9cb3977a03d934fe1147afe6a3bc44837ae8db70f6cb66c80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a9c63ba97d02b1b2d02410d6ddc7a535ca96fd05b338de8ee4ee537bf7a94d060f35301c02b4bbd5975b5799f4c368ee7fd260f6320dc3d0efe61d7b3172337
|
7
|
+
data.tar.gz: fb5f71617b0075ba2b6075edbacec9d5bc6d747d1889b2dd207a3d510fca4e55ecbed2b506e0f305953d7147dcb35ee0c1ac28971843a749bc0076ba31f875db
|
@@ -71,6 +71,7 @@ module Api
|
|
71
71
|
param :description_format, String, :required => false, :desc => N_('Override the description format from the template for this invocation only')
|
72
72
|
param :execution_timeout_interval, Integer, :required => false, :desc => N_('Override the timeout interval from the template for this invocation only')
|
73
73
|
param :feature, String, :required => false, :desc => N_('Remote execution feature label that should be triggered, job template assigned to this feature will be used')
|
74
|
+
param :time_to_pickup, Integer, :required => false, :desc => N_('Override the global time to pickup interval for this invocation only')
|
74
75
|
|
75
76
|
RemoteExecutionProvider.providers.each_value do |provider|
|
76
77
|
next if !provider.respond_to?(:provider_inputs_doc) || provider.provider_inputs_doc.empty?
|
@@ -120,6 +120,25 @@ class JobInvocationsController < ApplicationController
|
|
120
120
|
redirect_back(:fallback_location => job_invocation_path(@job_invocation))
|
121
121
|
end
|
122
122
|
|
123
|
+
def preview_job_invocations_per_host
|
124
|
+
job_invocations = resource_base.search_for("targeted_host_id = #{params[:host_id]} and (status=#{params[:status]})").limit(params[:limit] || 3)
|
125
|
+
|
126
|
+
job_invocations = job_invocations.map do |job|
|
127
|
+
@job_invocation = job
|
128
|
+
template_invocation = job.template_invocations.find { |template_inv| template_inv.host_id == params[:host_id].to_i }
|
129
|
+
task = template_invocation.try(:run_host_job_task)
|
130
|
+
status_mapper = task ? HostStatus::ExecutionStatus::ExecutionTaskStatusMapper.new(task) : job
|
131
|
+
{
|
132
|
+
start_at: job.start_at,
|
133
|
+
description: job.description,
|
134
|
+
id: job.id,
|
135
|
+
status: status_mapper.status,
|
136
|
+
status_label: status_mapper.status_label,
|
137
|
+
}
|
138
|
+
end
|
139
|
+
render :json => {:job_invocations => job_invocations}
|
140
|
+
end
|
141
|
+
|
123
142
|
private
|
124
143
|
|
125
144
|
def action_permission
|
@@ -130,7 +149,7 @@ class JobInvocationsController < ApplicationController
|
|
130
149
|
'create'
|
131
150
|
when 'cancel'
|
132
151
|
'cancel'
|
133
|
-
when 'chart'
|
152
|
+
when 'chart', 'preview_job_invocations_per_host'
|
134
153
|
'view'
|
135
154
|
else
|
136
155
|
super
|
@@ -13,11 +13,13 @@ class UiJobWizardController < ApplicationController
|
|
13
13
|
def template
|
14
14
|
job_template = JobTemplate.authorized.find(params[:id])
|
15
15
|
advanced_template_inputs, template_inputs = map_template_inputs(job_template.template_inputs_with_foreign).partition { |x| x["advanced"] }
|
16
|
+
provider_inputs = job_template.provider.provider_inputs.map { |input| input.instance_values.merge({:provider_input => true, default: input.value }) }
|
16
17
|
render :json => {
|
17
18
|
:job_template => job_template,
|
18
19
|
:effective_user => job_template.effective_user,
|
19
20
|
:template_inputs => template_inputs,
|
20
|
-
:
|
21
|
+
:provider_name => job_template.provider.provider_input_namespace,
|
22
|
+
:advanced_template_inputs => advanced_template_inputs+provider_inputs,
|
21
23
|
}
|
22
24
|
end
|
23
25
|
|
@@ -238,7 +238,7 @@ module RemoteExecutionHelper
|
|
238
238
|
|
239
239
|
def load_template_from_task(template_invocation, target)
|
240
240
|
task = template_invocation.job_invocation.sub_task_for_host(target)
|
241
|
-
return if
|
241
|
+
return if [nil, 'scheduled', 'planning'].include?(task&.state)
|
242
242
|
|
243
243
|
task.execution_plan.actions[1].try(:input).try(:[], 'script')
|
244
244
|
end
|
@@ -180,7 +180,7 @@ module Actions
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def exit_status
|
183
|
-
input[:with_event_logging] ? task.template_invocation.template_invocation_events.find_by(event_type: 'exit')
|
183
|
+
input[:with_event_logging] ? task.template_invocation.template_invocation_events.find_by(event_type: 'exit')&.event : delegated_output[:exit_status]
|
184
184
|
end
|
185
185
|
|
186
186
|
def host_id
|
@@ -1,6 +1,6 @@
|
|
1
1
|
object @job_invocation
|
2
2
|
|
3
|
-
attributes :id, :description, :job_category, :targeting_id, :status, :start_at, :status_label, :ssh_user
|
3
|
+
attributes :id, :description, :job_category, :targeting_id, :status, :start_at, :status_label, :ssh_user, :time_to_pickup
|
4
4
|
|
5
5
|
node do |invocation|
|
6
6
|
{
|
@@ -127,7 +127,7 @@
|
|
127
127
|
</div>
|
128
128
|
|
129
129
|
<div class="form-group">
|
130
|
-
<%= add_label({ :label => _('Type of query'), :label_help => _("Type has impact on when is the query evaluated to hosts.<br><ul><li><b>Static</b> - evaluates just after you submit this form</li><li><b>Dynamic</b> - evaluates just before the execution is started, so if it's
|
130
|
+
<%= add_label({ :label => _('Type of query'), :label_help => _("Type has impact on when is the query evaluated to hosts.<br><ul><li><b>Static</b> - evaluates just after you submit this form</li><li><b>Dynamic</b> - evaluates just before the execution is started, so if it's planned in future, targeted hosts set may change before it</li></ul>") }, f, :targetting_type) %>
|
131
131
|
|
132
132
|
<div class="col-md-4">
|
133
133
|
<%= radio_button_f targeting_fields, :targeting_type, :value => Targeting::STATIC_TYPE, :text => _(Targeting::TYPES[Targeting::STATIC_TYPE]) %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% title @job_invocation.description %>
|
2
2
|
<% stylesheet 'foreman_remote_execution/foreman_remote_execution' %>
|
3
|
-
<% javascript '
|
3
|
+
<% javascript 'foreman_remote_execution/template_invocation' %>
|
4
4
|
<% javascript *webpack_asset_paths('foreman_remote_execution', :extension => 'js') %>
|
5
5
|
<% content_for(:stylesheets) do %>
|
6
6
|
<%= webpacked_plugins_css_for :foreman_remote_execution %>
|
@@ -9,6 +9,6 @@
|
|
9
9
|
<p><%= link_to _('Learn more about this in the documentation.'),
|
10
10
|
documentation_url('1.ForemanRemoteExecution1.3Manual', :root_url => 'https://www.theforeman.org/plugins/foreman_remote_execution/1.3/index.html#'), :rel => 'external' %></p>
|
11
11
|
<div class="blank-slate-pf-main-action">
|
12
|
-
<%=
|
12
|
+
<%= display_link_if_authorized(_("Run Job"), { :action => :create }, { :class => "btn btn-primary btn-lg" }) %>
|
13
13
|
</div>
|
14
14
|
</div>
|
data/config/routes.rb
CHANGED
@@ -23,6 +23,7 @@ Rails.application.routes.draw do
|
|
23
23
|
match 'old/job_invocations/:id/rerun', to: 'job_invocations#rerun', via: [:get, :post], as: 'form_rerun_job_invocation'
|
24
24
|
resources :job_invocations, :only => [:create, :show, :index] do
|
25
25
|
collection do
|
26
|
+
get 'preview_job_invocations_per_host'
|
26
27
|
post 'refresh'
|
27
28
|
get 'chart'
|
28
29
|
get 'preview_hosts'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class RexSettingCategoryToDsl < ActiveRecord::Migration[6.0]
|
2
2
|
def up
|
3
|
-
Setting.where(category: 'Setting::RemoteExecution').update_all(category: 'Setting')
|
3
|
+
Setting.where(category: 'Setting::RemoteExecution').update_all(category: 'Setting') if column_exists?(:settings, :category)
|
4
4
|
end
|
5
5
|
end
|
@@ -183,7 +183,7 @@ module ForemanRemoteExecution
|
|
183
183
|
permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
|
184
184
|
permission :create_job_invocations, { :job_invocations => [:new, :create, :refresh, :rerun, :preview_hosts],
|
185
185
|
'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
|
186
|
-
permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search], :template_invocations => [:show],
|
186
|
+
permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search, :preview_job_invocations_per_host], :template_invocations => [:show],
|
187
187
|
'api/v2/job_invocations' => [:index, :show, :output, :raw_output, :outputs] }, :resource_type => 'JobInvocation'
|
188
188
|
permission :view_template_invocations, { :template_invocations => [:show],
|
189
189
|
'api/v2/template_invocations' => [:template_invocations], :ui_job_wizard => [:job_invocation] }, :resource_type => 'TemplateInvocation'
|
data/locale/action_names.rb
CHANGED
Binary file
|