1 from starcluster import exception
2 from starcluster.logger import log
3
4 from completers import ClusterCompleter
5
6
8 """
9 terminate [options] <cluster_tag> ...
10
11 Terminate a running or stopped cluster
12
13 Example:
14
15 $ starcluster terminate mycluster
16
17 This will terminate a currently running or stopped cluster tagged
18 "mycluster".
19
20 All nodes will be terminated, all spot requests (if any) will be
21 cancelled, and the cluster's security group will be removed. If the
22 cluster uses EBS-backed nodes then each node's root volume will be
23 deleted. If the cluster uses "cluster compute" instance types the
24 cluster's placement group will also be removed.
25 """
26 names = ['terminate']
27
29 parser.add_option("-c", "--confirm", dest="confirm",
30 action="store_true", default=False,
31 help="Do not prompt for confirmation, "
32 "just terminate the cluster")
33
35 cl = self.cm.get_cluster(cluster_name, require_keys=False)
36 if not self.opts.confirm:
37 action = 'Terminate'
38 if cl.is_ebs_cluster():
39 action = 'Terminate EBS'
40 resp = raw_input(
41 "%s cluster %s (y/n)? " % (action, cluster_name))
42 if resp not in ['y', 'Y', 'yes']:
43 log.info("Aborting...")
44 return
45 cl.terminate_cluster()
46
59
68