smart_proxy_remote_execution_ssh 0.5.0 → 0.5.3
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/lib/smart_proxy_remote_execution_ssh/cockpit.rb +7 -2
- data/lib/smart_proxy_remote_execution_ssh/plugin.rb +1 -1
- data/lib/smart_proxy_remote_execution_ssh/runners/polling_script_runner.rb +2 -1
- data/lib/smart_proxy_remote_execution_ssh/runners/script_runner.rb +4 -2
- data/lib/smart_proxy_remote_execution_ssh/version.rb +1 -1
- data/lib/smart_proxy_remote_execution_ssh.rb +1 -1
- data/settings.d/remote_execution_ssh.yml.example +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf6517f6a98386e246650454c7deb049b7583c7653040eb63bbdf8e3cc27f0a
|
4
|
+
data.tar.gz: 12b0aa0d067e45c73ee65286f69d1556f7ae8b1c47624845e1e0a7e96c341e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f873d27dc9b5ba0b9c10d7d227058618d901a48643ba31e491e1530b34356aa88ac8a197e9731d83a2a535ffa7577ba674578af8b90de3d02f7537d6359063d5
|
7
|
+
data.tar.gz: d72dfc490d0f71a076885eeabf435a89bca3658ce31a465666725a19e1d0f3c682d51f899922a2b6dbfdbfe8ee8d880fc0b0d0a13ac2536c5ce8f276f64b059b
|
@@ -164,6 +164,8 @@ module Proxy::RemoteExecution
|
|
164
164
|
out_read, out_write = IO.pipe
|
165
165
|
err_read, err_write = IO.pipe
|
166
166
|
|
167
|
+
# Force the script runner to initialize its logger
|
168
|
+
script_runner.logger
|
167
169
|
pid = spawn(*script_runner.send(:get_args, command), :in => in_read, :out => out_write, :err => err_write)
|
168
170
|
[in_read, out_write, err_write].each(&:close)
|
169
171
|
|
@@ -176,7 +178,7 @@ module Proxy::RemoteExecution
|
|
176
178
|
inner_system_ssh_loop out_buf, err_buf, in_buf, pid
|
177
179
|
end
|
178
180
|
|
179
|
-
def
|
181
|
+
def inner_system_ssh_loop(out_buf, err_buf, in_buf, pid)
|
180
182
|
err_buf_raw = ''
|
181
183
|
readers = [buf_socket, out_buf, err_buf]
|
182
184
|
loop do
|
@@ -185,6 +187,9 @@ module Proxy::RemoteExecution
|
|
185
187
|
(ready_readers || []).each { |reader| reader.close if reader.fill.zero? }
|
186
188
|
|
187
189
|
proxy_data(out_buf, in_buf)
|
190
|
+
if buf_socket.closed?
|
191
|
+
script_runner.close_session
|
192
|
+
end
|
188
193
|
|
189
194
|
if out_buf.closed?
|
190
195
|
code = Process.wait2(pid).last.exitstatus
|
@@ -202,7 +207,7 @@ module Proxy::RemoteExecution
|
|
202
207
|
rescue # rubocop:disable Style/RescueStandardError
|
203
208
|
send_error(400, err_buf_raw) unless @started
|
204
209
|
ensure
|
205
|
-
[
|
210
|
+
[out_buf, err_buf, in_buf].each(&:close)
|
206
211
|
end
|
207
212
|
|
208
213
|
def proxy_data(out_buf, in_buf)
|
@@ -14,7 +14,7 @@ module Proxy::RemoteExecution::Ssh
|
|
14
14
|
:kerberos_auth => false,
|
15
15
|
# When set to nil, makes REX use the runner's default interval
|
16
16
|
# :runner_refresh_interval => nil,
|
17
|
-
:ssh_log_level => :
|
17
|
+
:ssh_log_level => :error,
|
18
18
|
:cleanup_working_dirs => true,
|
19
19
|
# :mqtt_broker => nil,
|
20
20
|
# :mqtt_port => nil,
|
@@ -40,7 +40,8 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
40
40
|
control_script_finish = "#{@control_script_path} init-script-finish"
|
41
41
|
<<-SCRIPT.gsub(/^ +\| /, '')
|
42
42
|
| export CONTROL_SCRIPT="#{@control_script_path}"
|
43
|
-
|
|
43
|
+
| #{"chown #{@user_method.effective_user} '#{@base_dir}'" if @user_method.cli_command_prefix}
|
44
|
+
| #{@user_method.cli_command_prefix} sh -c '#{main_script}; #{control_script_finish}' #{close_fds} &
|
44
45
|
| echo $! > '#{@base_dir}/pid'
|
45
46
|
SCRIPT
|
46
47
|
end
|
@@ -201,8 +201,10 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
201
201
|
raise 'Control socket file does not exist' unless File.exist?(local_command_file("socket"))
|
202
202
|
@logger.debug("Sending exit request for session #{@ssh_user}@#{@host}")
|
203
203
|
args = ['/usr/bin/ssh', @host, "-o", "User=#{@ssh_user}", "-o", "ControlPath=#{local_command_file("socket")}", "-O", "exit"].flatten
|
204
|
-
*, err = session(args, in_stream: false, out_stream: false)
|
205
|
-
read_output_debug(err)
|
204
|
+
pid, *, err = session(args, in_stream: false, out_stream: false)
|
205
|
+
result = read_output_debug(err)
|
206
|
+
Process.wait(pid)
|
207
|
+
result
|
206
208
|
end
|
207
209
|
|
208
210
|
def close
|
@@ -47,7 +47,7 @@ module Proxy::RemoteExecution
|
|
47
47
|
when :ssh
|
48
48
|
Plugin.logger.warn('Deprecated option async_ssh used together with ssh mode, switching mode to ssh-async.')
|
49
49
|
Plugin.settings.mode = :'ssh-async'
|
50
|
-
when :'async
|
50
|
+
when :'ssh-async'
|
51
51
|
# This is a noop
|
52
52
|
else
|
53
53
|
Plugin.logger.warn('Deprecated option async_ssh used together with incompatible mode, ignoring.')
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# Defines the verbosity of logging coming from ssh command
|
17
17
|
# one of :debug, :info, :error, :fatal
|
18
18
|
# must be lower than general log level
|
19
|
-
# :ssh_log_level:
|
19
|
+
# :ssh_log_level: error
|
20
20
|
|
21
21
|
# Remove working directories on job completion
|
22
22
|
# :cleanup_working_dirs: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_remote_execution_ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
- !ruby/object:Gem::Version
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
|
-
rubygems_version: 3.1.
|
206
|
+
rubygems_version: 3.1.4
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Ssh remote execution provider for Foreman Smart-Proxy
|