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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sshkit/backends/abstract.rb +1 -1
- data/lib/sshkit/command.rb +1 -1
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/test_command.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ca10e8e575b23bb6af6e722b5bf9b20f819d20
|
4
|
+
data.tar.gz: 34661b9aaffdd53c25d0b846ab6a527033e1089a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab42dc88a3cd6ab4fa9b66d6dad7ccf92c43922373e6f8dc713e5bca3a4c99e7f15c0f7c303595f92c1f00c8e6649ad6c661119c5e5b308ac497b3c7d97eb39
|
7
|
+
data.tar.gz: 446e9c9150504729c40a88ab4e16d44c9ee941ed191a58ed7a1970f501307c43e509a7142fb5c7fd635355c9ba6585baef254c93e9f81f1f43632a06a144a9fc
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
data/lib/sshkit/command.rb
CHANGED
@@ -163,7 +163,7 @@ module SSHKit
|
|
163
163
|
|
164
164
|
def user(&block)
|
165
165
|
return yield unless options[:user]
|
166
|
-
"sudo
|
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)
|
data/lib/sshkit/version.rb
CHANGED
data/test/unit/test_command.rb
CHANGED
@@ -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
|
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
|
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
|
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
|
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.
|
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-
|
12
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|