summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/vm.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-09-15 22:21:38 -0700
committerelijah <elijah@riseup.net>2016-09-15 22:21:38 -0700
commitb13cbe4730a986a3b60c4c70ce2b5f16da8a4feb (patch)
tree1b166072fa972933c601dad6c1a45f7fb6ff0b25 /lib/leap_cli/commands/vm.rb
parent5cf0ff60c2038773bd9c5546d3930f5434670578 (diff)
leap vm: grab ssh host key when adding a new vm
Diffstat (limited to 'lib/leap_cli/commands/vm.rb')
-rw-r--r--lib/leap_cli/commands/vm.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/leap_cli/commands/vm.rb b/lib/leap_cli/commands/vm.rb
index b1911596..790774f1 100644
--- a/lib/leap_cli/commands/vm.rb
+++ b/lib/leap_cli/commands/vm.rb
@@ -253,6 +253,16 @@ module LeapCli; module Commands
if server
cloud.bind_server_to_node(server)
+ ssh_host_key = cloud.wait_for_ssh_host_key(server)
+ if ssh_host_key.nil?
+ log :warning, "We could not get a SSH host key." do
+ log "Try running `leap vm add #{node.name}` again later."
+ end
+ else
+ log :saving, "SSH host key for #{node.name}"
+ write_file! [:node_ssh_pub_key, node.name], ssh_host_key.to_s
+ end
+ log "done", :color => :green, :style => :bold
end
end