cucumber-sshd 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cucumber/sshd/server.rb +14 -17
- 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: bdf66c3017c8748e8500c2afd205d4933a6e4620effbb8a52c1016fad5e81371
|
4
|
+
data.tar.gz: 46a7249f56a23a5c22a6803edc2ed721bd09795b2d13e26ee94236113baa74a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae3978de0a18792dfb0fe0721e967eff7b30064eae2ea945e2b0c642999e15a5c992a54e8777b28a664d6a56a8f2d7679a06015da17d65e793e7429d78b243f8
|
7
|
+
data.tar.gz: 4f4389002a3ab1378595397e77c1b1c015334f505653284f596f55809c0423629bdf510ee4fabd96fbd23972644ece6c0deb906da2e6a423a9ed0c3cf2b66b42
|
data/lib/cucumber/sshd/server.rb
CHANGED
@@ -4,8 +4,10 @@ module Cucumber
|
|
4
4
|
HOST = 'some_host.test'.freeze
|
5
5
|
HOSTNAME = 'localhost'.freeze
|
6
6
|
COMMAND = '/usr/sbin/sshd'.freeze
|
7
|
-
COMMAND_ARGS = '-
|
8
|
-
|
7
|
+
COMMAND_ARGS = '-De'.freeze
|
8
|
+
TMP_FILE_PREFIX = 'cucumber_sshd_'.freeze
|
9
|
+
WAIT_READY_DELAY = 0.005
|
10
|
+
WAIT_READY_TRIGGER = 'Server listening'.freeze
|
9
11
|
KEY_PATH = 'etc/ssh_host_rsa_key'.freeze
|
10
12
|
KEY_PUB_PATH = [KEY_PATH, '.pub'].join.freeze
|
11
13
|
SSHD_CONFIG_PATH = 'etc/sshd_config'.freeze
|
@@ -47,6 +49,7 @@ module Cucumber
|
|
47
49
|
@port = port
|
48
50
|
@debug = debug
|
49
51
|
@persist = persist
|
52
|
+
@stderr = Tempfile.new TMP_FILE_PREFIX
|
50
53
|
end
|
51
54
|
|
52
55
|
def configure
|
@@ -56,17 +59,10 @@ module Cucumber
|
|
56
59
|
end
|
57
60
|
|
58
61
|
def start
|
62
|
+
print_server_info if debug?
|
59
63
|
Dir.chdir home do
|
60
|
-
@pid =
|
61
|
-
$stderr.reopen '/dev/null' unless debug?
|
62
|
-
exec command
|
63
|
-
end
|
64
|
-
if debug?
|
65
|
-
sleep 0.05
|
66
|
-
fail "`#{command}` failed" if Process.waitpid pid, Process::WNOHANG
|
67
|
-
end
|
64
|
+
@pid = spawn *command, err: @stderr
|
68
65
|
end
|
69
|
-
print_server_info if debug?
|
70
66
|
wait_ready
|
71
67
|
end
|
72
68
|
|
@@ -84,8 +80,8 @@ module Cucumber
|
|
84
80
|
COMMAND,
|
85
81
|
'-f',
|
86
82
|
SSHD_CONFIG_PATH,
|
87
|
-
|
88
|
-
]
|
83
|
+
COMMAND_ARGS
|
84
|
+
]
|
89
85
|
end
|
90
86
|
|
91
87
|
def configure_client
|
@@ -130,6 +126,7 @@ CUCUMBER SSHD STARTING ---------------------------------------------------------
|
|
130
126
|
HOME: #{home}
|
131
127
|
LISTEN: #{addr}:#{port}
|
132
128
|
PERSIST: #{persist}
|
129
|
+
COMMAND: #{command.join ' '}
|
133
130
|
--------------------------------------------------------------------------------
|
134
131
|
eoh
|
135
132
|
end
|
@@ -139,10 +136,10 @@ PERSIST: #{persist}
|
|
139
136
|
end
|
140
137
|
|
141
138
|
def wait_ready
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
139
|
+
loop do
|
140
|
+
break if (IO.read @stderr.path).include? WAIT_READY_TRIGGER
|
141
|
+
sleep WAIT_READY_DELAY
|
142
|
+
end
|
146
143
|
end
|
147
144
|
|
148
145
|
def write_file_secure path, content
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-sshd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.3.
|
83
|
+
rubygems_version: 3.3.14
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Cucumber sshd helpers
|