foreman_remote_execution 13.2.6 → 14.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.tx/config +1 -1
- data/app/controllers/ui_job_wizard_controller.rb +1 -1
- data/app/helpers/job_invocations_helper.rb +1 -1
- data/app/lib/foreman_remote_execution/renderer_methods.rb +14 -0
- data/app/models/concerns/foreman_remote_execution/errors_flattener.rb +2 -2
- data/app/views/template_invocations/show.html.erb +1 -1
- data/app/views/templates/script/package_action.erb +1 -1
- data/config/initializers/inflections.rb +6 -0
- data/db/migrate/20240522093413_migrate_smart_proxy_ids_to_template_invocations.rb +3 -0
- data/lib/foreman_remote_execution/engine.rb +243 -254
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/Makefile +12 -2
- data/test/functional/ui_job_wizard_controller_test.rb +1 -1
- metadata +4 -4
- data/app/services/renderer_methods.rb +0 -12
- data/locale/action_names.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a73b13cdd10e99e44456d4b8dc1bbf8fe654dd6b83eb929e657df49d44b75078
|
4
|
+
data.tar.gz: a09d30bd37238e0dadd1e8bb8b32d41292df56aea1a03f19fdd2ab6386664ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6633435cacf5d2e835d8391bf2d035844d87db9be34c9fbd134d140a10559779b0f940109ba6feb8dfb0f35ab5b08accc5bec75c94e28ec12accc837c10c795c
|
7
|
+
data.tar.gz: 0e0417551e20786be7c7c87d1e694596ef8f118dbf303fece462810a6d4577f7bd99208dc6f8555cfb91b87a73914fc96a20185d9d7e2a3f6e76103cca5db31a
|
data/.gitignore
CHANGED
data/.tx/config
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# macros to fetch information about invoked jobs
|
4
|
+
module ForemanRemoteExecution
|
5
|
+
module RendererMethods
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
def find_job_invocation_by_id(job_id, preload: nil)
|
9
|
+
JobInvocation.preload(preload).find_by(id: job_id)
|
10
|
+
rescue ActiveRecord::NotFound => _e
|
11
|
+
raise ::Foreman::Exception.new(N_("Can't find Job Invocation for an id %s"), job_id)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -7,8 +7,8 @@ module ForemanRemoteExecution
|
|
7
7
|
def flattened_errors
|
8
8
|
errors = Hash.new { |h, k| h[k] = [] }
|
9
9
|
# self.errors is ActiveModel::Errors, not Hash and doesn't have the #each_key method
|
10
|
-
self.errors.
|
11
|
-
messages = self.errors
|
10
|
+
self.errors.attribute_names.each do |key|
|
11
|
+
messages = self.errors.messages_for(key)
|
12
12
|
invalid_objects = invalid_objects_for_attribute(key)
|
13
13
|
if invalid_objects.blank?
|
14
14
|
errors[key] = messages
|
@@ -148,7 +148,7 @@ handle_zypp_res_codes () {
|
|
148
148
|
end
|
149
149
|
-%>
|
150
150
|
zypper refresh
|
151
|
-
zypper -n <%= action %> <%= input("options") %> <%= input("package") %>
|
151
|
+
zypper -n --gpg-auto-import-keys <%= action %> <%= input("options") %> <%= input("package") %>
|
152
152
|
handle_zypp_res_codes $? "<%= action %>"
|
153
153
|
<% end -%>
|
154
154
|
RETVAL=$?
|
@@ -1,10 +1,13 @@
|
|
1
1
|
class MigrateSmartProxyIdsToTemplateInvocations < ActiveRecord::Migration[6.0]
|
2
2
|
def up
|
3
|
+
proxy_lookup_cache = {}
|
3
4
|
ForemanTasks::Link.joins(:task)
|
4
5
|
.where(resource_type: 'SmartProxy', task: { label: 'Actions::RemoteExecution::RunHostJob' })
|
5
6
|
.where.not(resource_id: nil)
|
6
7
|
.find_in_batches do |batch|
|
7
8
|
batch.group_by(&:resource_id).each do |resource_id, links|
|
9
|
+
proxy_lookup_cache[resource_id] = SmartProxy.where(id: resource_id).exists? unless proxy_lookup_cache.key?(resource_id)
|
10
|
+
next unless proxy_lookup_cache[resource_id]
|
8
11
|
template_invocation_ids = ForemanTasks::Link.where(resource_type: 'TemplateInvocation', task_id: links.map(&:task_id)).select(:resource_id)
|
9
12
|
TemplateInvocation.where(id: template_invocation_ids).update_all(smart_proxy_id: resource_id)
|
10
13
|
end
|
@@ -4,10 +4,6 @@ module ForemanRemoteExecution
|
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
engine_name 'foreman_remote_execution'
|
6
6
|
|
7
|
-
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
8
|
-
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
9
|
-
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
10
|
-
|
11
7
|
# Precompile any JS or CSS files under app/assets/
|
12
8
|
# If requiring files from each other, list them explicitly here to avoid precompiling the same
|
13
9
|
# content twice.
|
@@ -26,15 +22,6 @@ module ForemanRemoteExecution
|
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
29
|
-
# A workaround for https://projects.theforeman.org/issues/30685
|
30
|
-
initializer 'foreman_remote_execution.rails_loading_workaround' do
|
31
|
-
# Without this, in production environment the module gets prepended too
|
32
|
-
# late and the extensions do not get applied
|
33
|
-
# TODO: Remove this and from config.to_prepare once there is an extension
|
34
|
-
# point in Foreman
|
35
|
-
ProvisioningTemplatesHelper.prepend ForemanRemoteExecution::JobTemplatesExtensions
|
36
|
-
end
|
37
|
-
|
38
25
|
initializer 'foreman_remote_execution.apipie' do
|
39
26
|
Apipie.configuration.checksum_path += ['/api/']
|
40
27
|
end
|
@@ -45,257 +32,259 @@ module ForemanRemoteExecution
|
|
45
32
|
ForemanTasks.dynflow.config.eager_load_paths << File.join(ForemanRemoteExecution::Engine.root, 'app/lib/actions')
|
46
33
|
end
|
47
34
|
|
48
|
-
initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
35
|
+
initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |app|
|
36
|
+
app.reloader.to_prepare do
|
37
|
+
Foreman::Plugin.register :foreman_remote_execution do
|
38
|
+
requires_foreman '>= 3.13'
|
39
|
+
register_global_js_file 'global'
|
40
|
+
register_gettext
|
41
|
+
|
42
|
+
apipie_documented_controllers ["#{ForemanRemoteExecution::Engine.root}/app/controllers/api/v2/*.rb"]
|
43
|
+
ApipieDSL.configuration.dsl_classes_matchers += [
|
44
|
+
"#{ForemanRemoteExecution::Engine.root}/app/lib/foreman_remote_execution/renderer/**/*.rb",
|
45
|
+
]
|
46
|
+
automatic_assets(false)
|
47
|
+
precompile_assets(*assets_to_precompile)
|
48
|
+
|
49
|
+
# Add settings to a Remote Execution category
|
50
|
+
settings do
|
51
|
+
category :remote_execution, N_('Remote Execution') do
|
52
|
+
setting 'remote_execution_fallback_proxy',
|
53
|
+
type: :boolean,
|
54
|
+
description: N_('Search the host for any proxy with Remote Execution, useful when the host has no subnet or the subnet does not have an execution proxy'),
|
55
|
+
default: false,
|
56
|
+
full_name: N_('Fallback to Any Proxy')
|
57
|
+
setting 'remote_execution_global_proxy',
|
58
|
+
type: :boolean,
|
59
|
+
description: N_('Search for remote execution proxy outside of the proxies assigned to the host. The search will be limited to the host\'s organization and location.'),
|
60
|
+
default: true,
|
61
|
+
full_name: N_('Enable Global Proxy')
|
62
|
+
setting 'remote_execution_ssh_user',
|
63
|
+
type: :string,
|
64
|
+
description: N_('Default user to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_user.'),
|
65
|
+
default: 'root',
|
66
|
+
full_name: N_('SSH User')
|
67
|
+
setting 'remote_execution_effective_user',
|
68
|
+
type: :string,
|
69
|
+
description: N_('Default user to use for executing the script. If the user differs from the SSH user, su or sudo is used to switch the user.'),
|
70
|
+
default: 'root',
|
71
|
+
full_name: N_('Effective User')
|
72
|
+
setting 'remote_execution_effective_user_method',
|
73
|
+
type: :string,
|
74
|
+
description: N_('What command should be used to switch to the effective user. One of %s') % ::SSHExecutionProvider::EFFECTIVE_USER_METHODS.inspect,
|
75
|
+
default: 'sudo',
|
76
|
+
full_name: N_('Effective User Method'),
|
77
|
+
collection: proc { Hash[::SSHExecutionProvider::EFFECTIVE_USER_METHODS.map { |method| [method, method] }] }
|
78
|
+
setting 'remote_execution_effective_user_password',
|
79
|
+
type: :string,
|
80
|
+
description: N_('Effective user password'),
|
81
|
+
default: '',
|
82
|
+
full_name: N_('Effective user password'),
|
83
|
+
encrypted: true
|
84
|
+
setting 'remote_execution_sync_templates',
|
85
|
+
type: :boolean,
|
86
|
+
description: N_('Whether we should sync templates from disk when running db:seed.'),
|
87
|
+
default: true,
|
88
|
+
full_name: N_('Sync Job Templates')
|
89
|
+
setting 'remote_execution_ssh_port',
|
90
|
+
type: :integer,
|
91
|
+
description: N_('Port to use for SSH communication. Default port 22. You may override per host by setting a parameter called remote_execution_ssh_port.'),
|
92
|
+
default: 22,
|
93
|
+
full_name: N_('SSH Port')
|
94
|
+
setting 'remote_execution_connect_by_ip',
|
95
|
+
type: :boolean,
|
96
|
+
description: N_('Should the ip addresses on host interfaces be preferred over the fqdn? '\
|
97
|
+
'It is useful when DNS not resolving the fqdns properly. You may override this per host by setting a parameter called remote_execution_connect_by_ip. '\
|
98
|
+
'For dual-stacked hosts you should consider the remote_execution_connect_by_ip_prefer_ipv6 setting'),
|
99
|
+
default: false,
|
100
|
+
full_name: N_('Connect by IP')
|
101
|
+
setting 'remote_execution_connect_by_ip_prefer_ipv6',
|
102
|
+
type: :boolean,
|
103
|
+
description: N_('When connecting using ip address, should the IPv6 addresses be preferred? '\
|
104
|
+
'If no IPv6 address is set, it falls back to IPv4 automatically. You may override this per host by setting a parameter called remote_execution_connect_by_ip_prefer_ipv6. '\
|
105
|
+
'By default and for compatibility, IPv4 will be preferred over IPv6 by default'),
|
106
|
+
default: false,
|
107
|
+
full_name: N_('Prefer IPv6 over IPv4')
|
108
|
+
setting 'remote_execution_ssh_password',
|
109
|
+
type: :string,
|
110
|
+
description: N_('Default password to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_password'),
|
111
|
+
default: nil,
|
112
|
+
full_name: N_('Default SSH password'),
|
113
|
+
encrypted: true
|
114
|
+
setting 'remote_execution_ssh_key_passphrase',
|
115
|
+
type: :string,
|
116
|
+
description: N_('Default key passphrase to use for SSH. You may override per host by setting a parameter called remote_execution_ssh_key_passphrase'),
|
117
|
+
default: nil,
|
118
|
+
full_name: N_('Default SSH key passphrase'),
|
119
|
+
encrypted: true
|
120
|
+
setting 'remote_execution_workers_pool_size',
|
121
|
+
type: :integer,
|
122
|
+
description: N_('Amount of workers in the pool to handle the execution of the remote execution jobs. Restart of the dynflowd/foreman-tasks service is required.'),
|
123
|
+
default: 5,
|
124
|
+
full_name: N_('Workers pool size')
|
125
|
+
setting 'remote_execution_cleanup_working_dirs',
|
126
|
+
type: :boolean,
|
127
|
+
description: N_('When enabled, working directories will be removed after task completion. You may override this per host by setting a parameter called remote_execution_cleanup_working_dirs.'),
|
128
|
+
default: true,
|
129
|
+
full_name: N_('Cleanup working directories')
|
130
|
+
setting 'remote_execution_cockpit_url',
|
131
|
+
type: :string,
|
132
|
+
description: N_('Where to find the Cockpit instance for the Web Console button. By default, no button is shown.'),
|
133
|
+
default: nil,
|
134
|
+
full_name: N_('Cockpit URL')
|
135
|
+
setting 'remote_execution_form_job_template',
|
136
|
+
type: :string,
|
137
|
+
description: N_('Choose a job template that is pre-selected in job invocation form'),
|
138
|
+
default: 'Run Command - Script Default',
|
139
|
+
full_name: N_('Form Job Template'),
|
140
|
+
collection: proc { Hash[JobTemplate.unscoped.map { |template| [template.name, template.name] }] }
|
141
|
+
setting 'remote_execution_job_invocation_report_template',
|
142
|
+
type: :string,
|
143
|
+
description: N_('Select a report template used for generating a report for a particular remote execution job'),
|
144
|
+
default: 'Job - Invocation Report',
|
145
|
+
full_name: N_('Job Invocation Report Template'),
|
146
|
+
collection: proc { ForemanRemoteExecution.job_invocation_report_templates_select }
|
147
|
+
setting 'remote_execution_time_to_pickup',
|
148
|
+
type: :integer,
|
149
|
+
description: N_('Time in seconds within which the host has to pick up a job. If the job is not picked up within this limit, the job will be cancelled. Defaults to 1 day. Applies only to pull-mqtt based jobs.'),
|
150
|
+
default: 24 * 60 * 60,
|
151
|
+
full_name: N_('Time to pickup')
|
152
|
+
end
|
164
153
|
end
|
165
|
-
end
|
166
154
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
155
|
+
# Add permissions
|
156
|
+
security_block :foreman_remote_execution do
|
157
|
+
permission :view_job_templates, { :job_templates => [:index, :show, :revision, :auto_complete_search, :auto_complete_job_category, :preview, :export],
|
158
|
+
:'api/v2/job_templates' => [:index, :show, :revision, :export],
|
159
|
+
:'api/v2/template_inputs' => [:index, :show],
|
160
|
+
:'api/v2/foreign_input_sets' => [:index, :show],
|
161
|
+
:ui_job_wizard => [:categories, :template, :resources, :job_invocation]}, :resource_type => 'JobTemplate'
|
162
|
+
permission :create_job_templates, { :job_templates => [:new, :create, :clone_template, :import],
|
163
|
+
:'api/v2/job_templates' => [:create, :clone, :import] }, :resource_type => 'JobTemplate'
|
164
|
+
permission :edit_job_templates, { :job_templates => [:edit, :update],
|
165
|
+
:'api/v2/job_templates' => [:update],
|
166
|
+
:'api/v2/template_inputs' => [:create, :update, :destroy],
|
167
|
+
:'api/v2/foreign_input_sets' => [:create, :update, :destroy]}, :resource_type => 'JobTemplate'
|
168
|
+
permission :view_remote_execution_features, { :remote_execution_features => [:index, :show],
|
169
|
+
:'api/v2/remote_execution_features' => [:index, :show, :available_remote_execution_features]},
|
170
|
+
:resource_type => 'RemoteExecutionFeature'
|
171
|
+
permission :edit_remote_execution_features, { :remote_execution_features => [:update],
|
172
|
+
:'api/v2/remote_execution_features' => [:update ]}, :resource_type => 'RemoteExecutionFeature'
|
173
|
+
permission :destroy_job_templates, { :job_templates => [:destroy],
|
174
|
+
:'api/v2/job_templates' => [:destroy] }, :resource_type => 'JobTemplate'
|
175
|
+
permission :lock_job_templates, { :job_templates => [:lock, :unlock] }, :resource_type => 'JobTemplate'
|
176
|
+
permission :create_job_invocations, { :job_invocations => [:new, :create, :legacy_create, :refresh, :rerun, :preview_hosts],
|
177
|
+
'api/v2/job_invocations' => [:create, :rerun] }, :resource_type => 'JobInvocation'
|
178
|
+
permission :view_job_invocations, { :job_invocations => [:index, :chart, :show, :auto_complete_search, :preview_job_invocations_per_host], :template_invocations => [:show],
|
179
|
+
'api/v2/job_invocations' => [:index, :show, :output, :raw_output, :outputs] }, :resource_type => 'JobInvocation'
|
180
|
+
permission :view_template_invocations, { :template_invocations => [:show],
|
181
|
+
'api/v2/template_invocations' => [:template_invocations], :ui_job_wizard => [:job_invocation] }, :resource_type => 'TemplateInvocation'
|
182
|
+
permission :create_template_invocations, {}, :resource_type => 'TemplateInvocation'
|
183
|
+
permission :execute_jobs_on_infrastructure_hosts, {}, :resource_type => 'JobInvocation'
|
184
|
+
permission :cancel_job_invocations, { :job_invocations => [:cancel], 'api/v2/job_invocations' => [:cancel] }, :resource_type => 'JobInvocation'
|
185
|
+
# this permissions grants user to get auto completion hints when setting up filters
|
186
|
+
permission :filter_autocompletion_for_template_invocation, { :template_invocations => [ :auto_complete_search, :index ] },
|
187
|
+
:resource_type => 'TemplateInvocation'
|
188
|
+
permission :cockpit_hosts, { 'cockpit' => [:redirect, :host_ssh_params] }, :resource_type => 'Host'
|
189
|
+
end
|
202
190
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
191
|
+
USER_PERMISSIONS = [
|
192
|
+
:view_job_templates,
|
193
|
+
:view_job_invocations,
|
194
|
+
:create_job_invocations,
|
195
|
+
:create_template_invocations,
|
196
|
+
:view_hosts,
|
197
|
+
:view_smart_proxies,
|
198
|
+
:view_remote_execution_features,
|
199
|
+
].freeze
|
200
|
+
MANAGER_PERMISSIONS = USER_PERMISSIONS + [
|
201
|
+
:cancel_job_invocations,
|
202
|
+
:destroy_job_templates,
|
203
|
+
:edit_job_templates,
|
204
|
+
:create_job_templates,
|
205
|
+
:lock_job_templates,
|
206
|
+
:view_audit_logs,
|
207
|
+
:filter_autocompletion_for_template_invocation,
|
208
|
+
:edit_remote_execution_features,
|
209
|
+
]
|
210
|
+
|
211
|
+
# Add a new role called 'Remote Execution User ' if it doesn't exist
|
212
|
+
role 'Remote Execution User', USER_PERMISSIONS, 'Role with permissions to run remote execution jobs against hosts'
|
213
|
+
role 'Remote Execution Manager', MANAGER_PERMISSIONS, 'Role with permissions to manage job templates, remote execution features, cancel jobs and view audit logs'
|
214
|
+
|
215
|
+
add_all_permissions_to_default_roles(except: [:execute_jobs_on_infrastructure_hosts])
|
216
|
+
add_permissions_to_default_roles({
|
217
|
+
Role::MANAGER => [:execute_jobs_on_infrastructure_hosts],
|
218
|
+
Role::SITE_MANAGER => USER_PERMISSIONS + [:execute_jobs_on_infrastructure_hosts],
|
219
|
+
})
|
220
|
+
|
221
|
+
# add menu entry
|
222
|
+
menu :top_menu, :job_templates,
|
223
|
+
url_hash: { controller: :job_templates, action: :index },
|
224
|
+
caption: N_('Job templates'),
|
225
|
+
parent: :hosts_menu,
|
226
|
+
after: :provisioning_templates
|
227
|
+
menu :admin_menu, :remote_execution_features,
|
228
|
+
url_hash: { controller: :remote_execution_features, action: :index },
|
229
|
+
caption: N_('Remote Execution Features'),
|
230
|
+
parent: :administer_menu,
|
231
|
+
after: :bookmarks
|
232
|
+
|
233
|
+
menu :top_menu, :job_invocations,
|
234
|
+
url_hash: { controller: :job_invocations, action: :index },
|
235
|
+
caption: N_('Jobs'),
|
236
|
+
parent: :monitor_menu,
|
237
|
+
after: :audits
|
238
|
+
|
239
|
+
menu :labs_menu, :job_invocations_detail,
|
240
|
+
url_hash: { controller: :job_invocations, action: :show },
|
241
|
+
caption: N_('Job invocations detail'),
|
242
|
+
parent: :lab_features_menu,
|
243
|
+
url: '/experimental/job_invocations_detail/1'
|
244
|
+
|
245
|
+
register_custom_status HostStatus::ExecutionStatus
|
246
|
+
# add dashboard widget
|
247
|
+
# widget 'foreman_remote_execution_widget', name: N_('Foreman plugin template widget'), sizex: 4, sizey: 1
|
248
|
+
widget 'dashboard/latest-jobs', :name => N_('Latest Jobs'), :sizex => 6, :sizey => 1
|
249
|
+
|
250
|
+
parameter_filter Subnet, :remote_execution_proxies, :remote_execution_proxy_ids => []
|
251
|
+
parameter_filter Nic::Interface do |ctx|
|
252
|
+
ctx.permit :execution
|
253
|
+
end
|
266
254
|
|
267
|
-
|
268
|
-
|
255
|
+
register_graphql_query_field :job_invocations, '::Types::JobInvocation', :collection_field
|
256
|
+
register_graphql_query_field :job_invocation, '::Types::JobInvocation', :record_field
|
269
257
|
|
270
|
-
|
258
|
+
register_graphql_mutation_field :create_job_invocation, ::Mutations::JobInvocations::Create
|
271
259
|
|
272
|
-
|
260
|
+
extend_template_helpers ForemanRemoteExecution::RendererMethods
|
273
261
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
262
|
+
extend_rabl_template 'api/v2/smart_proxies/main', 'api/v2/smart_proxies/pubkey'
|
263
|
+
extend_rabl_template 'api/v2/interfaces/main', 'api/v2/interfaces/execution_flag'
|
264
|
+
extend_rabl_template 'api/v2/subnets/show', 'api/v2/subnets/remote_execution_proxies'
|
265
|
+
extend_rabl_template 'api/v2/hosts/main', 'api/v2/host/main'
|
266
|
+
parameter_filter ::Subnet, :remote_execution_proxy_ids
|
279
267
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
268
|
+
describe_host do
|
269
|
+
multiple_actions_provider :rex_hosts_multiple_actions
|
270
|
+
overview_buttons_provider :rex_host_overview_buttons
|
271
|
+
end
|
284
272
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
273
|
+
# Extend Registration module
|
274
|
+
extend_allowed_registration_vars :remote_execution_interface
|
275
|
+
extend_allowed_registration_vars :setup_remote_execution_pull
|
276
|
+
ForemanTasks.dynflow.eager_load_actions!
|
277
|
+
extend_observable_events(
|
278
|
+
::Dynflow::Action.descendants.select do |klass|
|
279
|
+
klass <= ::Actions::ObservableAction
|
280
|
+
end.map(&:namespaced_event_names) +
|
281
|
+
RemoteExecutionFeature.all.pluck(:label).flat_map do |label|
|
282
|
+
[::Actions::RemoteExecution::RunHostJob, ::Actions::RemoteExecution::RunHostsJob].map do |klass|
|
283
|
+
klass.feature_job_event_names(label)
|
284
|
+
end
|
296
285
|
end
|
297
|
-
|
298
|
-
|
286
|
+
)
|
287
|
+
end
|
299
288
|
end
|
300
289
|
end
|
301
290
|
|
data/locale/Makefile
CHANGED
@@ -31,9 +31,16 @@ all-mo: $(MOFILES)
|
|
31
31
|
cat $@
|
32
32
|
! grep -q msgid $@
|
33
33
|
|
34
|
-
%.edit.po:
|
34
|
+
%.edit.po: %.po.time_stamp
|
35
35
|
touch $@
|
36
36
|
|
37
|
+
# gettext will trash the .edit.po file if the time stamp doesn't exist or is older than the po file
|
38
|
+
%.po.time_stamp: %.po
|
39
|
+
touch --reference $< $@
|
40
|
+
|
41
|
+
# Prevent make from treating this as an intermediate file to be cleaned up
|
42
|
+
.PRECIOUS: %.po.time_stamp
|
43
|
+
|
37
44
|
check: $(POXFILES)
|
38
45
|
|
39
46
|
# Unify duplicate translations
|
@@ -43,7 +50,10 @@ uniq-po:
|
|
43
50
|
done
|
44
51
|
|
45
52
|
tx-pull: $(EDITFILES)
|
46
|
-
|
53
|
+
# Initialize new languages
|
54
|
+
cd .. && tx pull -f --all --minimum-perc 50
|
55
|
+
# Force update all existing languages
|
56
|
+
cd .. && tx pull -f --minimum-perc 0
|
47
57
|
for f in $(EDITFILES) ; do \
|
48
58
|
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
|
49
59
|
done
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_plugin_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class UIJobWizardControllerTest < ActionController::TestCase
|
4
4
|
def setup
|
5
5
|
FactoryBot.create(:job_template, :job_category => 'cat1')
|
6
6
|
FactoryBot.create(:job_template, :job_category => 'cat2')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 14.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Remote Execution team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- app/lib/actions/remote_execution/template_invocation_progress_logging.rb
|
171
171
|
- app/lib/foreman_remote_execution/provider_input.rb
|
172
172
|
- app/lib/foreman_remote_execution/renderer/scope/input.rb
|
173
|
+
- app/lib/foreman_remote_execution/renderer_methods.rb
|
173
174
|
- app/lib/proxy_api/remote_execution_ssh.rb
|
174
175
|
- app/mailers/.gitkeep
|
175
176
|
- app/mailers/rex_job_mailer.rb
|
@@ -213,7 +214,6 @@ files:
|
|
213
214
|
- app/overrides/subnet_proxies.rb
|
214
215
|
- app/services/default_proxy_proxy_selector.rb
|
215
216
|
- app/services/remote_execution_proxy_selector.rb
|
216
|
-
- app/services/renderer_methods.rb
|
217
217
|
- app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
|
218
218
|
- app/views/api/v2/foreign_input_sets/base.json.rabl
|
219
219
|
- app/views/api/v2/foreign_input_sets/create.json.rabl
|
@@ -297,6 +297,7 @@ files:
|
|
297
297
|
- app/views/templates/script/run_command.erb
|
298
298
|
- app/views/templates/script/run_downloaded_script.erb
|
299
299
|
- app/views/templates/script/service_action.erb
|
300
|
+
- config/initializers/inflections.rb
|
300
301
|
- config/routes.rb
|
301
302
|
- db/migrate/20150612121541_add_job_template_to_template.rb
|
302
303
|
- db/migrate/20150708133241_add_targeting.rb
|
@@ -372,7 +373,6 @@ files:
|
|
372
373
|
- lib/foreman_remote_execution/version.rb
|
373
374
|
- lib/tasks/foreman_remote_execution_tasks.rake
|
374
375
|
- locale/Makefile
|
375
|
-
- locale/action_names.rb
|
376
376
|
- locale/de/LC_MESSAGES/foreman_remote_execution.mo
|
377
377
|
- locale/de/foreman_remote_execution.po
|
378
378
|
- locale/en/LC_MESSAGES/foreman_remote_execution.mo
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# macros to fetch information about invoked jobs
|
4
|
-
module RendererMethods
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
def find_job_invocation_by_id(job_id, preload: nil)
|
8
|
-
JobInvocation.preload(preload).find_by(id: job_id)
|
9
|
-
rescue ActiveRecord::NotFound => _e
|
10
|
-
raise ::Foreman::Exception.new(N_("Can't find Job Invocation for an id %s"), job_id)
|
11
|
-
end
|
12
|
-
end
|
data/locale/action_names.rb
DELETED