sshkit 1.16.0 → 1.16.1
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/.travis.yml +8 -6
- data/CHANGELOG.md +6 -1
- data/EXAMPLES.md +4 -0
- data/lib/sshkit/command.rb +1 -1
- data/lib/sshkit/version.rb +1 -1
- data/test/functional/backends/test_netssh.rb +14 -0
- data/test/unit/test_command.rb +2 -2
- 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: adf8778cdb780fc5190e6e29a913f97c9367073850ec4db02c30ee5fca61b15e
|
4
|
+
data.tar.gz: b9ad84e2f7cdc7cfd6d5773954b764182a828b3b02886085ce29a96a75f1672f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a6fc9a49bf60dc427426a988499d081d0666c1a2e3ac06b57952a6352c3ae93c09792d464ad844295cf3a6fb69cfb238213b6bd93fdf5e761b603df205c36c
|
7
|
+
data.tar.gz: d1e3a4f0eb0cf3e3baca205bffe236581fc260f5c7e70cbd9155d64f827bc3ce6732f2f74f9024171f192aa2e0061dcb9894b651ded2a916479164d98dfcd4fd
|
data/.travis.yml
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
3
|
+
- 2.5
|
4
|
+
- 2.4
|
5
|
+
- 2.3
|
6
|
+
- 2.2
|
7
|
+
- 2.1
|
8
|
+
- 2.0
|
7
9
|
matrix:
|
8
10
|
include:
|
9
|
-
# Run Danger only once, on 2.
|
10
|
-
- rvm: 2.
|
11
|
+
# Run Danger only once, on 2.5
|
12
|
+
- rvm: 2.5
|
11
13
|
script: bundle exec danger
|
12
14
|
script: bundle exec rake test:units lint
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ appear at the top.
|
|
7
7
|
|
8
8
|
* Your contribution here!
|
9
9
|
|
10
|
+
## [1.16.1][] (2018-05-20)
|
11
|
+
|
12
|
+
* [#425](https://github.com/capistrano/sshkit/pull/425): Command#group incorrectly escapes double quotes, resulting in a a syntax error when specifying the group execution using `as`. This issue manifested when user command quotes changed from double quotes to single quotes. This fix removes the double quote escaping - [@pblesi](https://github.com/pblesi).
|
13
|
+
|
10
14
|
## [1.16.0][] (2018-02-03)
|
11
15
|
|
12
16
|
* [#417](https://github.com/capistrano/sshkit/pull/417): Cache key generation for connections becomes slow when `known_hosts` is a valid `net/ssh` options and `known_hosts` file is big. This changes the cache key generation and fixes performance issue - [@ElvinEfendi](https://github.com/ElvinEfendi).
|
@@ -738,7 +742,8 @@ version `0.0.5`.
|
|
738
742
|
|
739
743
|
First release.
|
740
744
|
|
741
|
-
[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.16.
|
745
|
+
[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.16.1...HEAD
|
746
|
+
[1.16.1]: https://github.com/capistrano/sshkit/compare/v1.16.0...v1.16.1
|
742
747
|
[1.16.0]: https://github.com/capistrano/sshkit/compare/v1.15.1...v1.16.0
|
743
748
|
[1.15.1]: https://github.com/capistrano/sshkit/compare/v1.15.0...v1.15.1
|
744
749
|
[1.15.0]: https://github.com/capistrano/sshkit/compare/v1.14.0...v1.15.0
|
data/EXAMPLES.md
CHANGED
@@ -32,6 +32,10 @@ end
|
|
32
32
|
## Run a command with specific environmental variables
|
33
33
|
|
34
34
|
```ruby
|
35
|
+
# Please see the documentation for caveats related to commands that do not use
|
36
|
+
# the command map [such as simple strings].
|
37
|
+
#
|
38
|
+
# https://github.com/capistrano/sshkit#the-command-map
|
35
39
|
on hosts do |host|
|
36
40
|
with rack_env: :test do
|
37
41
|
puts capture("env | grep RACK_ENV")
|
data/lib/sshkit/command.rb
CHANGED
@@ -182,7 +182,7 @@ module SSHKit
|
|
182
182
|
|
183
183
|
def group(&_block)
|
184
184
|
return yield unless options[:group]
|
185
|
-
|
185
|
+
%Q(sg #{options[:group]} -c "#{yield}")
|
186
186
|
# We could also use the so-called heredoc format perhaps:
|
187
187
|
#"newgrp #{options[:group]} <<EOC \\\"%s\\\" EOC" % %Q{#{yield}}
|
188
188
|
end
|
data/lib/sshkit/version.rb
CHANGED
@@ -42,6 +42,20 @@ module SSHKit
|
|
42
42
|
], command_lines
|
43
43
|
end
|
44
44
|
|
45
|
+
def test_group_netssh
|
46
|
+
Netssh.new(a_host) do
|
47
|
+
as user: :root, group: :admin do
|
48
|
+
execute :touch, 'restart.txt'
|
49
|
+
end
|
50
|
+
end.run
|
51
|
+
|
52
|
+
command_lines = @output.lines.select { |line| line.start_with?('Command:') }
|
53
|
+
assert_equal [
|
54
|
+
"Command: if ! sudo -u root whoami > /dev/null; then echo \"You cannot switch to user 'root' using sudo, please check the sudoers file\" 1>&2; false; fi\n",
|
55
|
+
"Command: sudo -u root -- sh -c 'sg admin -c \"/usr/bin/env touch restart.txt\"'\n"
|
56
|
+
], command_lines
|
57
|
+
end
|
58
|
+
|
45
59
|
def test_capture
|
46
60
|
captured_command_result = nil
|
47
61
|
Netssh.new(a_host) do |_host|
|
data/test/unit/test_command.rb
CHANGED
@@ -102,12 +102,12 @@ module SSHKit
|
|
102
102
|
|
103
103
|
def test_working_as_a_given_group
|
104
104
|
c = Command.new(:whoami, group: :devvers)
|
105
|
-
assert_equal
|
105
|
+
assert_equal 'sg devvers -c "/usr/bin/env whoami"', c.to_command
|
106
106
|
end
|
107
107
|
|
108
108
|
def test_working_as_a_given_user_and_group
|
109
109
|
c = Command.new(:whoami, user: :anotheruser, group: :devvers)
|
110
|
-
assert_equal
|
110
|
+
assert_equal %Q(sudo -u anotheruser -- sh -c 'sg devvers -c "/usr/bin/env whoami"'), c.to_command
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_umask
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
293
|
version: '0'
|
294
294
|
requirements: []
|
295
295
|
rubyforge_project:
|
296
|
-
rubygems_version: 2.7.
|
296
|
+
rubygems_version: 2.7.7
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
299
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|