sshkit 1.5.0 → 1.5.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
  SHA1:
3
- metadata.gz: 2be29e1ebec8acbfa5605fddeb959a1803f06581
4
- data.tar.gz: 51115f162047ee443d2383e05d49851ae1e9b056
3
+ metadata.gz: f8ca10e8e575b23bb6af6e722b5bf9b20f819d20
4
+ data.tar.gz: 34661b9aaffdd53c25d0b846ab6a527033e1089a
5
5
  SHA512:
6
- metadata.gz: 8f0e074042930ca893c2953712bce4abb47bc04387d98b0339aed07df8e2dfccef783ecaf6696b00d4d1d9c88b8d51bc6982fd9bc60aaa6343950e9da02a3260
7
- data.tar.gz: 5bf7f417df04ab339fe70dcb12377b248cf2eef18bf9a881ea9e23dd7eb2d62b717f6f2713dd68878173aef4f50af6a3920624fc6986b5972bce1b79e4672e7e
6
+ metadata.gz: 1ab42dc88a3cd6ab4fa9b66d6dad7ccf92c43922373e6f8dc713e5bca3a4c99e7f15c0f7c303595f92c1f00c8e6649ad6c661119c5e5b308ac497b3c7d97eb39
7
+ data.tar.gz: 446e9c9150504729c40a88ab4e16d44c9ee941ed191a58ed7a1970f501307c43e509a7142fb5c7fd635355c9ba6585baef254c93e9f81f1f43632a06a144a9fc
@@ -8,6 +8,10 @@ appear at the top.
8
8
  * Add your entries here, remember to credit yourself however you want to be
9
9
  credited!
10
10
 
11
+ ## 1.5.1
12
+
13
+ * Use `sudo -u` rather than `sudo su` to switch users. Mat Trudel
14
+
11
15
  ## 1.5.0
12
16
 
13
17
  * Deprecate background helper - too many badly behaved pseudo-daemons. Lee Hambley
@@ -97,7 +97,7 @@ module SSHKit
97
97
  @group = nil
98
98
  end
99
99
  execute <<-EOTEST, verbosity: Logger::DEBUG
100
- if ! sudo su #{@user} -c whoami > /dev/null
100
+ if ! sudo -u #{@user} whoami > /dev/null
101
101
  then echo "You cannot switch to user '#{@user}' using sudo, please check the sudoers file" 1>&2
102
102
  false
103
103
  fi
@@ -163,7 +163,7 @@ module SSHKit
163
163
 
164
164
  def user(&block)
165
165
  return yield unless options[:user]
166
- "sudo su #{options[:user]} -c '%s'" % %Q{#{yield}}
166
+ "sudo -u #{options[:user]} #{environment_string + " " unless environment_string.empty?}-- sh -c '%s'" % %Q{#{yield}}
167
167
  end
168
168
 
169
169
  def in_background(&block)
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
@@ -78,7 +78,7 @@ module SSHKit
78
78
 
79
79
  def test_working_as_a_given_user
80
80
  c = Command.new(:whoami, user: :anotheruser)
81
- assert_equal "sudo su anotheruser -c '/usr/bin/env whoami'", c.to_command
81
+ assert_equal "sudo -u anotheruser -- sh -c '/usr/bin/env whoami'", c.to_command
82
82
  end
83
83
 
84
84
  def test_working_as_a_given_group
@@ -88,7 +88,7 @@ module SSHKit
88
88
 
89
89
  def test_working_as_a_given_user_and_group
90
90
  c = Command.new(:whoami, user: :anotheruser, group: :devvers)
91
- assert_equal "sudo su anotheruser -c 'sg devvers -c \\\"/usr/bin/env whoami\\\"'", c.to_command
91
+ assert_equal "sudo -u anotheruser -- sh -c 'sg devvers -c \\\"/usr/bin/env whoami\\\"'", c.to_command
92
92
  end
93
93
 
94
94
  def test_umask
@@ -106,13 +106,13 @@ module SSHKit
106
106
  def test_umask_with_working_directory_and_user
107
107
  SSHKit.config.umask = '007'
108
108
  c = Command.new(:touch, 'somefile', in: '/var', user: 'alice')
109
- assert_equal "cd /var && umask 007 && sudo su alice -c '/usr/bin/env touch somefile'", c.to_command
109
+ assert_equal "cd /var && umask 007 && sudo -u alice -- sh -c '/usr/bin/env touch somefile'", c.to_command
110
110
  end
111
111
 
112
112
  def test_umask_with_env_and_working_directory_and_user
113
113
  SSHKit.config.umask = '007'
114
114
  c = Command.new(:touch, 'somefile', user: 'bob', env: {a: 'b'}, in: '/var')
115
- assert_equal "cd /var && umask 007 && ( A=b sudo su bob -c '/usr/bin/env touch somefile' )", c.to_command
115
+ assert_equal "cd /var && umask 007 && ( A=b sudo -u bob A=b -- sh -c '/usr/bin/env touch somefile' )", c.to_command
116
116
  end
117
117
 
118
118
  def test_verbosity_defaults_to_logger_info
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.5.0
4
+ version: 1.5.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: 2014-05-30 00:00:00.000000000 Z
12
+ date: 2014-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh