chake 0.4 → 0.4.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: e7488361bba23f010e6873f567d922653ed2dcb3
4
- data.tar.gz: e2166babc9c279160a4bd291418131d02fac9cfb
3
+ metadata.gz: 1df478d2c90d2ca124065d8f29ea659cceb973f7
4
+ data.tar.gz: c0c875fe667e97d240b448a17f0cd1df3ee36580
5
5
  SHA512:
6
- metadata.gz: a6a910451f2f1cd6c342441f2267fa75b1db5228ccb6be1d2580d9673f3a316b8dcc5ce6e8842129d5136b04d352d629df3a2b358f7a1cc3f9a1c56f61360dcb
7
- data.tar.gz: dd3c5e2644fcff4aeffe72a858a102f5a23b453c7d9162f54e9594cfdd91812725cb5e5987b0ef2f36aa19d4586d63bb606ef7b4536c724852bb6e33594b681d
6
+ metadata.gz: e374e3b0989135b0ad8f07d0efdae889d3e44e5013dc6427823cda3fc9c5eb9bdbef6fa85b2ef8b8a1e6aa853eee73bd09ee61f699ef6bdcb3e2887f087d8723
7
+ data.tar.gz: 98ca09e11b1fc6b4376f6497e49c2acdffc63a0bf6f68d23732518aacd35cd39c2b3e3dd60486d833ef28a7585635c55095b6a1dcb37c99aba4b3d3922b9d0f8
@@ -1,3 +1,11 @@
1
+ # 0.4.1
2
+
3
+ * Don't always assume the local username as the remote username for SSH
4
+ connections:
5
+ * `user@host`: connect with `user@host`
6
+ * `host`: connect with `host` (username will be obtained by SSH itself from
7
+ either its configuration files or the current username)
8
+
1
9
  # 0.4.0
2
10
 
3
11
  * Redesign build of RPM package
@@ -37,7 +37,7 @@ module Chake
37
37
  end
38
38
 
39
39
  def run_as_root(cmd)
40
- if node.username == 'root'
40
+ if node.remote_username == 'root'
41
41
  run(cmd)
42
42
  else
43
43
  run('sudo sh -c "' + cmd + '"')
@@ -39,7 +39,7 @@ module Chake
39
39
  end
40
40
 
41
41
  def ssh_target
42
- [node.username, node.hostname].compact.join('@')
42
+ [node.remote_username, node.hostname].compact.join('@')
43
43
  end
44
44
 
45
45
  end
@@ -12,6 +12,7 @@ module Chake
12
12
 
13
13
  attr_reader :hostname
14
14
  attr_reader :username
15
+ attr_reader :remote_username
15
16
  attr_reader :path
16
17
  attr_reader :data
17
18
 
@@ -35,6 +36,7 @@ module Chake
35
36
 
36
37
  @hostname = uri.host
37
38
  @username = uri.user || Etc.getpwuid.name
39
+ @remote_username = uri.user
38
40
  @path = uri.path || "/var/tmp/chef.#{username}"
39
41
  @data = data
40
42
 
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.4"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -10,4 +10,15 @@ describe Chake::Backend::Ssh do
10
10
 
11
11
  it('rsyncs over ssh') { expect(backend.rsync_dest).to eq('myuser@myhost:/srv/chef/') }
12
12
 
13
+ it 'uses no remote username if none was passed' do
14
+ node = Chake::Node.new('theserver')
15
+ expect(node.username).to eq(Etc.getpwuid.name)
16
+ expect(node.remote_username).to be_nil
17
+ end
18
+
19
+ it 'uses username is passwd' do
20
+ expect(node.username).to eq('myuser')
21
+ expect(node.remote_username).to eq('myuser')
22
+ end
23
+
13
24
  end
@@ -26,7 +26,7 @@ shared_examples "Chake::Backend" do |backend_class|
26
26
  end
27
27
 
28
28
  it('does not use sudo if already root') do
29
- allow(backend.node).to receive(:username).and_return('root')
29
+ allow(backend.node).to receive(:remote_username).and_return('root')
30
30
  expect(backend).to receive(:run).with('something')
31
31
  backend.run_as_root('something')
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro