aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-11-07 10:24:24 -0800
committerelijah <elijah@riseup.net>2014-11-07 10:24:24 -0800
commit38354dca9237c67668bf2510b3b43d8b2dbd5844 (patch)
treef5cdaf49235de52603bfb37e76f2fc7db4147319 /lib
parent527c5ba8515580c8dc46ea1f8ec497c7cd2703ed (diff)
downloadleap_cli-38354dca9237c67668bf2510b3b43d8b2dbd5844.tar.gz
leap_cli-38354dca9237c67668bf2510b3b43d8b2dbd5844.tar.bz2
node init - skip updating local host keys for vagrant nodes
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/commands/node_init.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/leap_cli/commands/node_init.rb b/lib/leap_cli/commands/node_init.rb
index 49030a7..33f6288 100644
--- a/lib/leap_cli/commands/node_init.rb
+++ b/lib/leap_cli/commands/node_init.rb
@@ -32,9 +32,11 @@ module LeapCli; module Commands
end
ssh.install_authorized_keys
ssh.install_prerequisites
- ssh.leap.log(:checking, "SSH host keys") do
- ssh.leap.capture(get_ssh_keys_cmd) do |response|
- update_local_ssh_host_keys(node, response[:data]) if response[:exitcode] == 0
+ unless node.vagrant?
+ ssh.leap.log(:checking, "SSH host keys") do
+ ssh.leap.capture(get_ssh_keys_cmd) do |response|
+ update_local_ssh_host_keys(node, response[:data]) if response[:exitcode] == 0
+ end
end
end
ssh.leap.log(:updating, "facts") do
@@ -151,7 +153,7 @@ module LeapCli; module Commands
return unless remote_keys.any?
current_key = SshKey.load(Path.named_path([:node_ssh_pub_key, node.name]))
best_key = SshKey.pick_best_key(remote_keys)
- return unless best_key
+ return unless best_key && current_key
if current_key != best_key
say(" One of the SSH host keys for node '#{node.name}' is better than what you currently have trusted.")
say(" Current key: #{current_key.summary}")