sshkit 1.23.2 → 1.25.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/.github/workflows/ci.yml +6 -33
- data/.github/workflows/push.yml +1 -1
- data/.rubocop.yml +6 -6
- data/.rubocop_todo.yml +3 -3
- data/Gemfile +0 -5
- data/RELEASING.md +1 -1
- data/lib/sshkit/backends/abstract.rb +3 -4
- data/lib/sshkit/backends/connection_pool.rb +0 -1
- data/lib/sshkit/runners/parallel.rb +0 -2
- data/lib/sshkit/version.rb +1 -1
- data/sshkit.gemspec +5 -4
- data/test/functional/backends/test_netssh.rb +2 -2
- data/test/unit/backends/test_abstract.rb +56 -6
- data/test/unit/test_command.rb +1 -6
- data/test/unit/test_configuration.rb +1 -6
- metadata +20 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab4c2342f826356f08f688cb17f29323b90c4a7ecc85836b1ceaf323c34ab13d
|
|
4
|
+
data.tar.gz: 1126ee211260588192c298847ce2a00b43c356d25751a13c6268f324b822d8a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6321a43251bc31e117660e049e53b35dec7154119a9fac2dce0e4eb855f8acc6b5539cbfe696e53457f8f6784eb8eebfa95a71c79e7b1a3a45b093d9e89e5ee
|
|
7
|
+
data.tar.gz: 41d021df58a4d4cd5f88762d29491fd71c603a97f31ac939d34825a42a27d1576dce5410cd6da7384833bb98fc107df1dfdaa4ca379d226b4f6417171ea2057f
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -8,21 +8,9 @@ jobs:
|
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
ruby:
|
|
12
|
-
[
|
|
13
|
-
"2.3",
|
|
14
|
-
"2.4",
|
|
15
|
-
"2.5",
|
|
16
|
-
"2.6",
|
|
17
|
-
"2.7",
|
|
18
|
-
"3.0",
|
|
19
|
-
"3.1",
|
|
20
|
-
"3.2",
|
|
21
|
-
"3.3",
|
|
22
|
-
"head",
|
|
23
|
-
]
|
|
11
|
+
ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"]
|
|
24
12
|
steps:
|
|
25
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v6
|
|
26
14
|
- name: Set up Ruby
|
|
27
15
|
uses: ruby/setup-ruby@v1
|
|
28
16
|
with:
|
|
@@ -33,24 +21,9 @@ jobs:
|
|
|
33
21
|
env:
|
|
34
22
|
RUBYOPT: ${{ startsWith(matrix.ruby, 'head') && '--enable=frozen-string-literal' || '' }}
|
|
35
23
|
|
|
36
|
-
test-legacy:
|
|
37
|
-
runs-on: ubuntu-20.04
|
|
38
|
-
strategy:
|
|
39
|
-
matrix:
|
|
40
|
-
ruby: ["2.0", "2.1", "2.2"]
|
|
41
|
-
steps:
|
|
42
|
-
- uses: actions/checkout@v4
|
|
43
|
-
- name: Set up Ruby
|
|
44
|
-
uses: ruby/setup-ruby@v1
|
|
45
|
-
with:
|
|
46
|
-
ruby-version: ${{ matrix.ruby }}
|
|
47
|
-
bundler-cache: true
|
|
48
|
-
- name: Run tests
|
|
49
|
-
run: bundle exec rake test:units
|
|
50
|
-
|
|
51
24
|
test-all:
|
|
52
25
|
runs-on: ubuntu-latest
|
|
53
|
-
needs:
|
|
26
|
+
needs: test
|
|
54
27
|
if: always()
|
|
55
28
|
steps:
|
|
56
29
|
- name: All tests ok
|
|
@@ -63,7 +36,7 @@ jobs:
|
|
|
63
36
|
rubocop:
|
|
64
37
|
runs-on: ubuntu-latest
|
|
65
38
|
steps:
|
|
66
|
-
- uses: actions/checkout@
|
|
39
|
+
- uses: actions/checkout@v6
|
|
67
40
|
- name: Set up Ruby
|
|
68
41
|
uses: ruby/setup-ruby@v1
|
|
69
42
|
with:
|
|
@@ -76,9 +49,9 @@ jobs:
|
|
|
76
49
|
runs-on: ubuntu-latest
|
|
77
50
|
strategy:
|
|
78
51
|
matrix:
|
|
79
|
-
ruby: ["2.
|
|
52
|
+
ruby: ["2.5", "ruby"]
|
|
80
53
|
steps:
|
|
81
|
-
- uses: actions/checkout@
|
|
54
|
+
- uses: actions/checkout@v6
|
|
82
55
|
- name: Set up Ruby
|
|
83
56
|
uses: ruby/setup-ruby@v1
|
|
84
57
|
with:
|
data/.github/workflows/push.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
|
|
|
3
3
|
AllCops:
|
|
4
4
|
DisplayCopNames: true
|
|
5
5
|
DisplayStyleGuide: true
|
|
6
|
-
TargetRubyVersion: 2.
|
|
6
|
+
TargetRubyVersion: 2.5
|
|
7
7
|
|
|
8
8
|
Lint/AmbiguousBlockAssociation:
|
|
9
9
|
Enabled: false
|
|
@@ -18,12 +18,12 @@ Style/ClassAndModuleChildren:
|
|
|
18
18
|
Enabled: false
|
|
19
19
|
Style/DoubleNegation:
|
|
20
20
|
Enabled: false
|
|
21
|
-
|
|
21
|
+
Naming/FileName:
|
|
22
22
|
Exclude:
|
|
23
23
|
- "Dangerfile"
|
|
24
|
-
|
|
24
|
+
Layout/IndentHeredoc:
|
|
25
25
|
Enabled: false
|
|
26
|
-
|
|
26
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
27
27
|
EnforcedStyle: no_space
|
|
28
28
|
Style/StringLiterals:
|
|
29
29
|
EnforcedStyle: double_quotes
|
|
@@ -47,7 +47,7 @@ Metrics/CyclomaticComplexity:
|
|
|
47
47
|
Enabled: false
|
|
48
48
|
Metrics/MethodLength:
|
|
49
49
|
Enabled: false
|
|
50
|
-
|
|
50
|
+
Naming/PredicateName:
|
|
51
51
|
Enabled: false
|
|
52
52
|
Metrics/LineLength:
|
|
53
53
|
Enabled: false
|
|
@@ -59,5 +59,5 @@ Metrics/ClassLength:
|
|
|
59
59
|
Enabled: false
|
|
60
60
|
Metrics/ModuleLength:
|
|
61
61
|
Enabled: false
|
|
62
|
-
|
|
62
|
+
Naming/AccessorMethodName:
|
|
63
63
|
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
|
@@ -439,7 +439,7 @@ Style/MethodDefParentheses:
|
|
|
439
439
|
# Offense count: 3
|
|
440
440
|
# Configuration parameters: SupportedStyles.
|
|
441
441
|
# SupportedStyles: snake_case, camelCase
|
|
442
|
-
|
|
442
|
+
Naming/MethodName:
|
|
443
443
|
EnforcedStyle: snake_case
|
|
444
444
|
Exclude:
|
|
445
445
|
- 'test/unit/test_color.rb'
|
|
@@ -460,7 +460,7 @@ Style/NumericPredicate:
|
|
|
460
460
|
- 'lib/sshkit/command.rb'
|
|
461
461
|
|
|
462
462
|
# Offense count: 1
|
|
463
|
-
|
|
463
|
+
Naming/BinaryOperatorParameterName:
|
|
464
464
|
Exclude:
|
|
465
465
|
- 'lib/sshkit/host.rb'
|
|
466
466
|
|
|
@@ -611,7 +611,7 @@ Style/UnneededPercentQ:
|
|
|
611
611
|
# Offense count: 1
|
|
612
612
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
613
613
|
# SupportedStyles: snake_case, normalcase, non_integer
|
|
614
|
-
|
|
614
|
+
Naming/VariableNumber:
|
|
615
615
|
Exclude:
|
|
616
616
|
- 'test/unit/backends/test_connection_pool.rb'
|
|
617
617
|
|
data/Gemfile
CHANGED
data/RELEASING.md
CHANGED
|
@@ -103,6 +103,7 @@ module SSHKit
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def as(who, &_block)
|
|
106
|
+
who_old = [@user, @group]
|
|
106
107
|
if who.is_a? Hash
|
|
107
108
|
@user = who[:user] || who["user"]
|
|
108
109
|
@group = who[:group] || who["group"]
|
|
@@ -118,8 +119,7 @@ module SSHKit
|
|
|
118
119
|
EOTEST
|
|
119
120
|
yield
|
|
120
121
|
ensure
|
|
121
|
-
|
|
122
|
-
remove_instance_variable(:@group)
|
|
122
|
+
@user, @group = *who_old
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
class << self
|
|
@@ -135,8 +135,7 @@ module SSHKit
|
|
|
135
135
|
# Backends which extend the Abstract backend should implement the following methods:
|
|
136
136
|
def upload!(_local, _remote, _options = {}) raise MethodUnavailableError end
|
|
137
137
|
def download!(_remote, _local=nil, _options = {}) raise MethodUnavailableError end
|
|
138
|
-
def execute_command(_cmd) raise MethodUnavailableError end
|
|
139
|
-
private :execute_command # Can inline after Ruby 2.1
|
|
138
|
+
private def execute_command(_cmd) raise MethodUnavailableError end
|
|
140
139
|
|
|
141
140
|
private
|
|
142
141
|
|
data/lib/sshkit/version.rb
CHANGED
data/sshkit.gemspec
CHANGED
|
@@ -19,19 +19,20 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
gem.name = "sshkit"
|
|
20
20
|
gem.require_paths = ["lib"]
|
|
21
21
|
gem.version = SSHKit::VERSION
|
|
22
|
+
gem.required_ruby_version = ">= 2.5"
|
|
22
23
|
|
|
23
|
-
gem.add_runtime_dependency('base64')
|
|
24
|
+
gem.add_runtime_dependency('base64')
|
|
25
|
+
gem.add_runtime_dependency('logger')
|
|
24
26
|
gem.add_runtime_dependency('net-ssh', '>= 2.8.0')
|
|
25
27
|
gem.add_runtime_dependency('net-scp', '>= 1.1.2')
|
|
26
28
|
gem.add_runtime_dependency('net-sftp', '>= 2.1.2')
|
|
27
|
-
gem.add_runtime_dependency('ostruct')
|
|
29
|
+
gem.add_runtime_dependency('ostruct')
|
|
28
30
|
|
|
29
31
|
gem.add_development_dependency('danger')
|
|
30
32
|
gem.add_development_dependency('minitest', '>= 5.0.0')
|
|
31
33
|
gem.add_development_dependency('minitest-reporters')
|
|
32
|
-
gem.add_development_dependency('rainbow', '~> 2.2.2')
|
|
33
34
|
gem.add_development_dependency('rake')
|
|
34
|
-
gem.add_development_dependency('rubocop', "~> 0.
|
|
35
|
+
gem.add_development_dependency('rubocop', "~> 0.52.0")
|
|
35
36
|
gem.add_development_dependency('mocha')
|
|
36
37
|
|
|
37
38
|
gem.add_development_dependency('bcrypt_pbkdf')
|
|
@@ -131,7 +131,7 @@ module SSHKit
|
|
|
131
131
|
|
|
132
132
|
def test_test_does_not_raise_on_non_zero_exit_status
|
|
133
133
|
Netssh.new(a_host) do |_host|
|
|
134
|
-
test :false
|
|
134
|
+
test :false # rubocop:disable Lint/BooleanSymbol
|
|
135
135
|
end.run
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -151,7 +151,7 @@ module SSHKit
|
|
|
151
151
|
# ensure we enable connection pool
|
|
152
152
|
SSHKit::Backend::Netssh.pool.idle_timeout = 10
|
|
153
153
|
Netssh.new(a_host) do |_host|
|
|
154
|
-
test :false
|
|
154
|
+
test :false # rubocop:disable Lint/BooleanSymbol
|
|
155
155
|
end.run
|
|
156
156
|
sleep 2.5
|
|
157
157
|
captured_command_result = nil
|
|
@@ -111,13 +111,63 @@ module SSHKit
|
|
|
111
111
|
assert_equal 'cd ~/foo && /usr/bin/env cat file', backend.executed_command.to_command
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
def
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
''
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
def test_as_properly_clears
|
|
115
|
+
backend = ExampleBackend.new do
|
|
116
|
+
as :root do
|
|
117
|
+
execute :cat, 'file', :strip => false
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
execute :cat, 'file', :strip => false
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
backend.run
|
|
124
|
+
|
|
125
|
+
assert_equal '/usr/bin/env cat file', backend.executed_command.to_command
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_as_root
|
|
129
|
+
backend = ExampleBackend.new do
|
|
130
|
+
as :root do
|
|
131
|
+
execute :cat, 'file', :strip => false
|
|
120
132
|
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
backend.run
|
|
136
|
+
|
|
137
|
+
assert_equal 'sudo -u root -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_nested_as
|
|
141
|
+
backend = ExampleBackend.new do
|
|
142
|
+
as :root do
|
|
143
|
+
as :other_user do
|
|
144
|
+
execute :cat, 'file', :strip => false
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
backend.run
|
|
150
|
+
|
|
151
|
+
assert_equal 'sudo -u other_user -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_nested_as_properly_clears
|
|
155
|
+
backend = ExampleBackend.new do
|
|
156
|
+
as :root do
|
|
157
|
+
as :other_user do
|
|
158
|
+
execute :cat, 'file', :strip => false
|
|
159
|
+
end
|
|
160
|
+
execute :cat, 'file', :strip => false
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
backend.run
|
|
165
|
+
|
|
166
|
+
assert_equal 'sudo -u root -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def test_background_logs_deprecation_warnings
|
|
170
|
+
deprecation_out = +''
|
|
121
171
|
SSHKit.config.deprecation_output = deprecation_out
|
|
122
172
|
|
|
123
173
|
ExampleBackend.new do
|
data/test/unit/test_command.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sshkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lee Hambley
|
|
8
8
|
- Tom Clements
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: logger
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: net-ssh
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,20 +136,6 @@ dependencies:
|
|
|
122
136
|
- - ">="
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
138
|
version: '0'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: rainbow
|
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
|
128
|
-
requirements:
|
|
129
|
-
- - "~>"
|
|
130
|
-
- !ruby/object:Gem::Version
|
|
131
|
-
version: 2.2.2
|
|
132
|
-
type: :development
|
|
133
|
-
prerelease: false
|
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
-
requirements:
|
|
136
|
-
- - "~>"
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
version: 2.2.2
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: rake
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,14 +156,14 @@ dependencies:
|
|
|
156
156
|
requirements:
|
|
157
157
|
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 0.
|
|
159
|
+
version: 0.52.0
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 0.
|
|
166
|
+
version: 0.52.0
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: mocha
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -329,14 +329,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
329
329
|
requirements:
|
|
330
330
|
- - ">="
|
|
331
331
|
- !ruby/object:Gem::Version
|
|
332
|
-
version: '
|
|
332
|
+
version: '2.5'
|
|
333
333
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
requirements:
|
|
335
335
|
- - ">="
|
|
336
336
|
- !ruby/object:Gem::Version
|
|
337
337
|
version: '0'
|
|
338
338
|
requirements: []
|
|
339
|
-
rubygems_version: 3.
|
|
339
|
+
rubygems_version: 3.7.2
|
|
340
340
|
specification_version: 4
|
|
341
341
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|
|
342
342
|
test_files:
|