sshkit 1.16.0 → 1.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf75e96cd318a56b4936975306dde6410ed40ca1cdc0635f694909024ae50f84
4
- data.tar.gz: 5d249a340c75d3916d5793547eb4bff73546a2776c6d818ad76689e10f283779
3
+ metadata.gz: adf8778cdb780fc5190e6e29a913f97c9367073850ec4db02c30ee5fca61b15e
4
+ data.tar.gz: b9ad84e2f7cdc7cfd6d5773954b764182a828b3b02886085ce29a96a75f1672f
5
5
  SHA512:
6
- metadata.gz: c059b4ac0c4bef25dbccc1e3d4c954f5367acdcec3e933a5251ef1f1a0d09b4bf0863d077c185e65f2939b5fbe7211bae88de43ec1cb363435e650723fda98c5
7
- data.tar.gz: 2694eb44390c5ed81ef44e0852c37efa5ca131639f6782ba653142773e1552373618a739af0b6e4ebf60b10b90cb92db40beea7742a3ffd7a57c8074b30fcc9e
6
+ metadata.gz: d7a6fc9a49bf60dc427426a988499d081d0666c1a2e3ac06b57952a6352c3ae93c09792d464ad844295cf3a6fb69cfb238213b6bd93fdf5e761b603df205c36c
7
+ data.tar.gz: d1e3a4f0eb0cf3e3baca205bffe236581fc260f5c7e70cbd9155d64f827bc3ce6732f2f74f9024171f192aa2e0061dcb9894b651ded2a916479164d98dfcd4fd
@@ -1,12 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.3
4
- - 2.2.4
5
- - 2.1.8
6
- - 2.0.0
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.3.3
10
- - rvm: 2.3.3
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
@@ -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.0...HEAD
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
@@ -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")
@@ -182,7 +182,7 @@ module SSHKit
182
182
 
183
183
  def group(&_block)
184
184
  return yield unless options[:group]
185
- "sg #{options[:group]} -c \\\"%s\\\"" % %Q{#{yield}}
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
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.16.1".freeze
3
3
  end
@@ -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|
@@ -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 "sg devvers -c \\\"/usr/bin/env whoami\\\"", c.to_command
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 "sudo -u anotheruser -- sh -c 'sg devvers -c \\\"/usr/bin/env whoami\\\"'", c.to_command
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.0
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-02-04 00:00:00.000000000 Z
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.4
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