ssh-short 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ssh_short/nodemapper.rb +2 -2
- data/lib/ssh_short/version.rb +1 -1
- data/spec/ssh_short/nodemapper_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA512:
|
3
|
-
|
4
|
-
|
3
|
+
metadata.gz: 8a9a320436c6e0b8a938afdd293d1858ccd464d573d9b00ed1107968aae483f2d90c0de3951cf9be001aed63d99061a3fd00f8be52ab09cc0330afb35ef42308
|
4
|
+
data.tar.gz: 463417fcb7a6d501490505394025a3622d3280a9170012804c99cf791662e7a948ab9f75adbe81c4cda04df55fc65c15e64bd8a24e3eb92f85b64088f7832711
|
5
5
|
SHA1:
|
6
|
-
|
7
|
-
|
6
|
+
metadata.gz: 640dc503747f8c948f83342d6f29f8d803a618b6
|
7
|
+
data.tar.gz: caef154ae31d2e1818976f4837ccc4ceb28e83d3
|
data/lib/ssh_short/nodemapper.rb
CHANGED
@@ -22,8 +22,7 @@ module SshShort
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def update_node(node)
|
25
|
-
|
26
|
-
if alias_changed
|
25
|
+
if alias_changed? node
|
27
26
|
existing_node_with_alias = get_node_by_alias(node[:alias])
|
28
27
|
if existing_node_with_alias
|
29
28
|
puts "Moving alias #{node[:alias]} from #{existing_node_with_alias[:host]} to #{node[:host]}"
|
@@ -55,6 +54,7 @@ module SshShort
|
|
55
54
|
private
|
56
55
|
|
57
56
|
def alias_changed?(node)
|
57
|
+
return false unless node[:alias]
|
58
58
|
old_node = get_node_by_host node[:host]
|
59
59
|
old_node ? old_node[:alias] != node[:alias] : true
|
60
60
|
end
|
data/lib/ssh_short/version.rb
CHANGED
@@ -141,6 +141,23 @@ describe SshShort::NodeMapper do
|
|
141
141
|
|
142
142
|
end
|
143
143
|
|
144
|
+
context 'when alias is nil' do
|
145
|
+
|
146
|
+
let(:node) { {:host => '10.0.0.6', :key => 'key_for_6.pem'} }
|
147
|
+
let(:nodemap) {
|
148
|
+
[
|
149
|
+
{:host => '10.0.0.1', :alias => 'alice', :key => 'key_for_alice.pem'},
|
150
|
+
{:host => '10.0.0.2', :key => 'key_for_2.pem'},
|
151
|
+
]
|
152
|
+
}
|
153
|
+
|
154
|
+
it 'does not move the empty alias' do
|
155
|
+
expect(nodemapper).to_not receive(:puts).with(/Moving alias/)
|
156
|
+
nodemapper.update_node(node)
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
144
161
|
end
|
145
162
|
|
146
163
|
describe 'get_aliases' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssh-short
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Poulton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-26 00:00:00 Z
|
13
13
|
dependencies: []
|
14
14
|
|
15
15
|
description: Easy ssh
|