smart_proxy_remote_execution_ssh 0.10.5 → 0.10.6
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524c8e78e1750ce728c124861bfb6b011b93b270dc9937866c54031fe8403a16
|
4
|
+
data.tar.gz: 3a67985ff45e4d81b993bdba3b0f849ab4dd25588452ad97799f3b152c36ee26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fee698f670f8d5c7e350a05407e38be6ce7c48c492d03c1cdaccbe896fb49ea54227f672e2ae46ebc34cd142507b72b9f49ee6285b3e0a1b669398e9d37c2b1c
|
7
|
+
data.tar.gz: 8da52396e057f78ddaee30d67d9d8aff50306ec49d7c20b7ba5d506f806494ecc8868ff2233db9285d4e799d21202a5491108fd7a974c97de00fdf8a15821462
|
@@ -99,6 +99,8 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
99
99
|
EXPECTED_POWER_ACTION_MESSAGES = ['restart host', 'shutdown host'].freeze
|
100
100
|
DEFAULT_REFRESH_INTERVAL = 1
|
101
101
|
|
102
|
+
UNSHARE_PREFIX = 'unshare --fork --kill-child'.freeze
|
103
|
+
|
102
104
|
def initialize(options, user_method, suspended_action: nil)
|
103
105
|
super suspended_action: suspended_action
|
104
106
|
@host = options.fetch(:hostname)
|
@@ -116,6 +118,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
116
118
|
@first_execution = options.fetch(:first_execution, false)
|
117
119
|
@user_method = user_method
|
118
120
|
@options = options
|
121
|
+
@supports_unshare = false
|
119
122
|
end
|
120
123
|
|
121
124
|
def self.build(options, suspended_action:)
|
@@ -147,6 +150,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
147
150
|
@connection = MultiplexedSSHConnection.new(@options.merge(:id => @id), logger: logger)
|
148
151
|
@connection.establish!
|
149
152
|
preflight_checks
|
153
|
+
detect_capabilities
|
150
154
|
prepare_start
|
151
155
|
script = initialization_script
|
152
156
|
logger.debug("executing script:\n#{indent_multiline(script)}")
|
@@ -160,6 +164,16 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
160
164
|
run_async(*args)
|
161
165
|
end
|
162
166
|
|
167
|
+
def detect_capabilities
|
168
|
+
script = cp_script_to_remote("#!/bin/sh\nexec #{UNSHARE_PREFIX} true")
|
169
|
+
begin
|
170
|
+
ensure_remote_command(script)
|
171
|
+
@supports_unshare = true
|
172
|
+
rescue; end
|
173
|
+
# The path should already be escaped
|
174
|
+
ensure_remote_command("rm #{script}")
|
175
|
+
end
|
176
|
+
|
163
177
|
def preflight_checks
|
164
178
|
script = cp_script_to_remote("#!/bin/sh\nexec true")
|
165
179
|
ensure_remote_command(script,
|
@@ -182,7 +196,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
182
196
|
@exit_code_path = File.join(File.dirname(@remote_script), 'exit_code')
|
183
197
|
@pid_path = File.join(File.dirname(@remote_script), 'pid')
|
184
198
|
@remote_script_wrapper = upload_data(
|
185
|
-
"echo $$ > #{@pid_path}; exec \"$@\";",
|
199
|
+
"echo $$ > #{@pid_path}; exec #{@supports_unshare ? UNSHARE_PREFIX : ''} \"$@\";",
|
186
200
|
File.join(File.dirname(@remote_script), 'script-wrapper'),
|
187
201
|
555)
|
188
202
|
end
|
@@ -247,6 +261,7 @@ module Proxy::RemoteExecution::Ssh::Runners
|
|
247
261
|
|
248
262
|
def publish_data(data, type, pm = nil)
|
249
263
|
pm ||= @process_manager
|
264
|
+
data = data.dup if data.frozen?
|
250
265
|
super(data.force_encoding('UTF-8'), type) unless @user_method.filter_password?(data)
|
251
266
|
@user_method.on_data(data, pm.stdin) if pm
|
252
267
|
end
|
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.10.
|
4
|
+
version: 0.10.6
|
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: 2024-
|
11
|
+
date: 2024-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|