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