foreman_remote_execution 17.1.0 → 17.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.
- checksums.yaml +4 -4
- data/app/models/remote_execution_provider.rb +11 -0
- data/app/models/script_execution_provider.rb +8 -5
- data/lib/foreman_remote_execution/plugin.rb +9 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/test/unit/remote_execution_provider_test.rb +56 -0
- data/webpack/JobInvocationDetail/CheckboxesActions.js +1 -0
- data/webpack/JobInvocationDetail/DropdownFilter.js +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e240991349f9cb6bc60f979202f8de2bde03d3d8100c13e701469aa2f8e29a97
|
|
4
|
+
data.tar.gz: f9936d90d62ce33221969367e5625cdf750c36922855142f460f46b18a8bc925
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eaf96768e4b112d387e660cca80d6b9dd360dd1145cf40b5540ea428bdf4bf3482e47591a05d2e2f0bcc05e36808e8163346258f323cc7f7f60917db3b930686
|
|
7
|
+
data.tar.gz: 56dbf3ac2a8cb8f90c8ae719fc5213c2fbf40588812bf98552fa8bdd967b6d1150632543dfb6992df09050d74813dd3eeb367cc857c3709a921a404b3772c823
|
|
@@ -76,6 +76,17 @@ class RemoteExecutionProvider
|
|
|
76
76
|
[true, 'true', 'True', 'TRUE', '1'].include?(setting)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
+
def remote_working_dir(host)
|
|
80
|
+
dir = host_setting(host, :remote_execution_remote_working_dir).to_s.strip
|
|
81
|
+
unless Pathname.new(dir).absolute?
|
|
82
|
+
raise ::Foreman::Exception.new(
|
|
83
|
+
N_('Remote working directory "%{current_value}" is not an absolute path'),
|
|
84
|
+
current_value: dir
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
dir
|
|
88
|
+
end
|
|
89
|
+
|
|
79
90
|
def effective_user_password(host)
|
|
80
91
|
host_setting(host, :remote_execution_effective_user_password)
|
|
81
92
|
end
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
class ScriptExecutionProvider < RemoteExecutionProvider
|
|
2
2
|
class << self
|
|
3
3
|
def proxy_command_options(template_invocation, host)
|
|
4
|
-
super.merge(
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
:
|
|
8
|
-
:
|
|
4
|
+
super.merge(
|
|
5
|
+
ssh_user: ssh_user(host, template_invocation.job_invocation),
|
|
6
|
+
effective_user: effective_user(template_invocation),
|
|
7
|
+
effective_user_method: effective_user_method(host),
|
|
8
|
+
cleanup_working_dirs: cleanup_working_dirs?(host),
|
|
9
|
+
remote_working_dir: remote_working_dir(host),
|
|
10
|
+
ssh_port: ssh_port(host)
|
|
11
|
+
)
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
def humanized_name
|
|
@@ -86,6 +86,15 @@ Foreman::Plugin.register :foreman_remote_execution do
|
|
|
86
86
|
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.'),
|
|
87
87
|
default: true,
|
|
88
88
|
full_name: N_('Cleanup working directories')
|
|
89
|
+
setting 'remote_execution_remote_working_dir',
|
|
90
|
+
type: :string,
|
|
91
|
+
description: N_('Directory on the host where remote execution jobs in push mode place and run their scripts. '\
|
|
92
|
+
'You can override this setting per host with the `remote_execution_remote_working_dir` host parameter.'),
|
|
93
|
+
default: '/var/tmp',
|
|
94
|
+
full_name: N_('Remote working directory')
|
|
95
|
+
validates 'remote_execution_remote_working_dir',
|
|
96
|
+
->(value) { Pathname.new(value.to_s.strip).absolute? },
|
|
97
|
+
message: N_('must be an absolute path')
|
|
89
98
|
setting 'remote_execution_cockpit_url',
|
|
90
99
|
type: :string,
|
|
91
100
|
description: N_('Where to find the Cockpit instance for the Web Console button. By default, no button is shown.'),
|
|
@@ -202,6 +202,62 @@ class RemoteExecutionProviderTest < ActiveSupport::TestCase
|
|
|
202
202
|
end
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
+
describe 'remote working directory' do
|
|
206
|
+
it 'defaults to the value of the global setting' do
|
|
207
|
+
assert_equal '/var/tmp', proxy_options[:remote_working_dir]
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it 'updates the value via settings' do
|
|
211
|
+
Setting[:remote_execution_remote_working_dir] = '/opt/rex'
|
|
212
|
+
assert_equal '/opt/rex', proxy_options[:remote_working_dir]
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'takes the value from host parameters over the global setting' do
|
|
216
|
+
Setting[:remote_execution_remote_working_dir] = '/opt/rex'
|
|
217
|
+
host.host_parameters << FactoryBot.build(:host_parameter, name: 'remote_execution_remote_working_dir', value: '/opt/host')
|
|
218
|
+
host.clear_host_parameters_cache!
|
|
219
|
+
assert_equal '/opt/host', proxy_options[:remote_working_dir]
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it 'takes the value inherited from the host group over the global setting' do
|
|
223
|
+
Setting[:remote_execution_remote_working_dir] = '/opt/rex'
|
|
224
|
+
hostgroup = FactoryBot.create(:hostgroup)
|
|
225
|
+
hostgroup.group_parameters << FactoryBot.build(:hostgroup_parameter, name: 'remote_execution_remote_working_dir', value: '/opt/hostgroup')
|
|
226
|
+
host.update!(hostgroup: hostgroup)
|
|
227
|
+
host.clear_host_parameters_cache!
|
|
228
|
+
assert_equal '/opt/hostgroup', proxy_options[:remote_working_dir]
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
it 'strips surrounding whitespace' do
|
|
232
|
+
Setting[:remote_execution_remote_working_dir] = ' /opt/rex '
|
|
233
|
+
assert_equal '/opt/rex', proxy_options[:remote_working_dir]
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
it 'rejects a setting value that is not an absolute path' do
|
|
237
|
+
assert_raises(ActiveRecord::RecordInvalid) do
|
|
238
|
+
Setting[:remote_execution_remote_working_dir] = 'opt/rex'
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it 'rejects an empty setting value' do
|
|
243
|
+
assert_raises(ActiveRecord::RecordInvalid) do
|
|
244
|
+
Setting[:remote_execution_remote_working_dir] = ''
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
it 'raises when the host parameter is not an absolute path' do
|
|
249
|
+
host.host_parameters << FactoryBot.build(:host_parameter, name: 'remote_execution_remote_working_dir', value: 'opt/host')
|
|
250
|
+
host.clear_host_parameters_cache!
|
|
251
|
+
assert_raises(::Foreman::Exception) { proxy_options }
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it 'raises when the host parameter is empty' do
|
|
255
|
+
host.host_parameters << FactoryBot.build(:host_parameter, name: 'remote_execution_remote_working_dir', value: '')
|
|
256
|
+
host.clear_host_parameters_cache!
|
|
257
|
+
assert_raises(::Foreman::Exception) { proxy_options }
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
205
261
|
describe '#find_ip_or_hostname' do
|
|
206
262
|
let(:host) do
|
|
207
263
|
FactoryBot.create(:host) do |host|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_remote_execution
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 17.
|
|
4
|
+
version: 17.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Foreman Remote Execution team
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-08-
|
|
10
|
+
date: 2026-08-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: deface
|