lib/gaptool-client.rb in gaptool-client-0.6.6 vs lib/gaptool-client.rb in gaptool-client-0.6.7
- old
+ new
@@ -108,12 +108,21 @@
end
end
class TerminateCommand < Clamp::Command
option ["-i", "--instance"], "INSTANCE", "Instance ID, e.g. i-12345678", :required => true
- option ["-z", "--zone"], "ZONE", "AWS availability zone of the node", :default => "us-west-2"
+ option ["-z", "--zone"], "ZONE", "AWS region of the node (deprecated/ignored)", :default => nil
def execute
- $api.terminatenode(instance, zone)
+ node = $api.getonenode(instance)
+ nodes = [node]
+ infohelper(nodes, false, false)
+ zone = node['zone'][0..-2]
+ print Rainbow("Terminate instance? [type yes to confirm]: ").red
+ res = $stdin.gets.chomp
+ if res.downcase == 'yes'
+ puts "Terminating instance #{node['role']}:#{node['environment']}:#{node['instance']} in region #{zone}"
+ $api.terminatenode(instance, zone)
+ end
end
end
class RuncmdCommand < Clamp::Command
option ["-r", "--role"], "ROLE", "Role name to ssh to", :required => true