sshkit 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/sshkit/host.rb +9 -14
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/test_coordinator.rb +0 -5
- data/test/unit/test_host.rb +12 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa55cb451f47225ec73ee08039769db6d0b94042
|
4
|
+
data.tar.gz: 1a518438483ce60cab579ed6e4324048a8026d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02de05f408918db9ce6ea869948200abd85bf732ea87fa92a2ccd12d8a2c96d3f113a3f92b36935050ab949dabca6cd1380f9d7bc262bfdc95c126dc555c7057
|
7
|
+
data.tar.gz: 3ccffca30784f05d5fc4cef3db7bb42b2111b1935c178a93e6c95819d275c2fc681731f3d47677056069ce0562dc291fc16c5744beca478a4711034b1cf384e5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.27
|
7
|
+
|
8
|
+
* Don't clobber SSH options with empty values. This allows Net::SSH to
|
9
|
+
do the right thing most of the time, and look into the SSH configuration
|
10
|
+
files.
|
11
|
+
|
6
12
|
## 0.0.26
|
7
13
|
|
8
14
|
* Pretty output no longer prints white text. ("Command.....")
|
data/lib/sshkit/host.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'etc'
|
2
1
|
require 'ostruct'
|
3
2
|
|
4
3
|
module SSHKit
|
@@ -67,21 +66,17 @@ module SSHKit
|
|
67
66
|
alias :== :eql?
|
68
67
|
alias :equal? :eql?
|
69
68
|
|
70
|
-
def to_key
|
71
|
-
to_s.to_sym
|
72
|
-
end
|
73
|
-
|
74
69
|
def to_s
|
75
|
-
|
70
|
+
hostname
|
76
71
|
end
|
77
72
|
|
78
73
|
def netssh_options
|
79
|
-
{
|
80
|
-
keys
|
81
|
-
port
|
82
|
-
user
|
83
|
-
password
|
84
|
-
|
74
|
+
{}.tap do |sho|
|
75
|
+
sho[:keys] = keys if keys.any?
|
76
|
+
sho[:port] = port if port
|
77
|
+
sho[:user] = user if user
|
78
|
+
sho[:password] = password if password
|
79
|
+
end
|
85
80
|
end
|
86
81
|
|
87
82
|
def properties
|
@@ -103,11 +98,11 @@ module SSHKit
|
|
103
98
|
end
|
104
99
|
|
105
100
|
def username
|
106
|
-
|
101
|
+
|
107
102
|
end
|
108
103
|
|
109
104
|
def port
|
110
|
-
|
105
|
+
|
111
106
|
end
|
112
107
|
|
113
108
|
def hostname
|
data/lib/sshkit/version.rb
CHANGED
@@ -32,11 +32,6 @@ module SSHKit
|
|
32
32
|
Coordinator.new %w{1.example.com 2.example.com 3.example.com}
|
33
33
|
end
|
34
34
|
|
35
|
-
def test_connection_manager_removes_duplicates_after_resolving_hosts
|
36
|
-
cm = Coordinator.new %w{user@1.example.com:22 user@1.example.com}
|
37
|
-
assert_equal ['user@1.example.com:22'], cm.hosts.map(&:to_s)
|
38
|
-
end
|
39
|
-
|
40
35
|
def test_the_connection_manager_yields_the_host_to_each_connection_instance
|
41
36
|
spy = lambda do |host|
|
42
37
|
execute "echo #{host.hostname}"
|
data/test/unit/test_host.rb
CHANGED
@@ -12,8 +12,6 @@ module SSHKit
|
|
12
12
|
|
13
13
|
def test_regular_hosts
|
14
14
|
h = Host.new 'example.com'
|
15
|
-
assert_equal 22, h.port
|
16
|
-
assert_equal `whoami`.chomp, h.username
|
17
15
|
assert_equal 'example.com', h.hostname
|
18
16
|
end
|
19
17
|
|
@@ -49,12 +47,8 @@ module SSHKit
|
|
49
47
|
assert_equal '1fff:0:a88:85a3::ac1f', h.hostname
|
50
48
|
end
|
51
49
|
|
52
|
-
def testing_host_casting_to_a_key
|
53
|
-
assert_equal :"user@example.com:1234", Host.new('user@example.com:1234').to_key
|
54
|
-
end
|
55
|
-
|
56
50
|
def testing_host_casting_to_a_string
|
57
|
-
assert_equal "
|
51
|
+
assert_equal "example.com", Host.new('user@example.com:1234').to_s
|
58
52
|
end
|
59
53
|
|
60
54
|
def test_assert_hosts_hash_equally
|
@@ -99,6 +93,17 @@ module SSHKit
|
|
99
93
|
end
|
100
94
|
end
|
101
95
|
|
96
|
+
def test_host_ssh_options_are_simply_missing_when_they_have_no_value
|
97
|
+
Host.new('my_config_is_in_the_ssh_config_file').tap do |host|
|
98
|
+
host.netssh_options.tap do |sho|
|
99
|
+
refute sho.has_key?(:port)
|
100
|
+
refute sho.has_key?(:password)
|
101
|
+
refute sho.has_key?(:keys)
|
102
|
+
refute sho.has_key?(:user)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
102
107
|
end
|
103
108
|
|
104
109
|
end
|