summaryrefslogtreecommitdiff
path: root/lib/leap_cli/cloud
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-24 17:37:00 -0700
committerelijah <elijah@riseup.net>2016-08-24 17:37:00 -0700
commitb928a8f29b40df545ac6a72ead6cb9ed6a36fbda (patch)
treee83790db3d53ae6c3d9195889a47e4800bdad601 /lib/leap_cli/cloud
parent205b61dfe721e6d88fc06b050a0497eeb35f4e02 (diff)
leap vm: fixed bug, added more sanity checking.
Diffstat (limited to 'lib/leap_cli/cloud')
-rw-r--r--lib/leap_cli/cloud/cloud.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/leap_cli/cloud/cloud.rb b/lib/leap_cli/cloud/cloud.rb
index f0bb45b8..86a84e69 100644
--- a/lib/leap_cli/cloud/cloud.rb
+++ b/lib/leap_cli/cloud/cloud.rb
@@ -103,7 +103,7 @@ module LeapCli
bail! "There are multiple VMs with the same node name tag! Manually remove one before continuing."
elsif instances.size == 1
instance_id = instances.first["instanceId"]
- server = cloud.compute.servers.get(instance_id)
+ server = @compute.servers.get(instance_id)
end
end
end
@@ -123,7 +123,16 @@ module LeapCli
# associates a node with a vm
#
def bind_server_to_node(server)
- raise ArgumentError, 'no node' unless @node
+ unless @node
+ raise ArgumentError, 'no node'
+ end
+ unless server.state == 'running'
+ bail! do
+ log 'The virtual machine `%s` must be running in order to bind it to the configuration `%s`.' % [
+ server.id, Path.relative_path(Path.named_path([:node_config, @node.name]))]
+ log 'To fix, run `leap vm start %s`' % server.id
+ end
+ end
# assign tag
@compute.create_tags(server.id, {'node_name' => @node.name})