aboutsummaryrefslogtreecommitdiff
path: root/ec2/spark_ec2.py
diff options
context:
space:
mode:
authorJean-Martin Archer <jeanmartin.archer@pulseenergy.com>2014-06-22 20:52:02 -0700
committerPatrick Wendell <pwendell@gmail.com>2014-06-22 20:54:42 -0700
commit9cb64b2c54b35eed373f54c2103f679b04e9af1e (patch)
treef2b9aa7e36f4c8a7e4645e8c9543ea653f84e19a /ec2/spark_ec2.py
parent9fc373e3a9a8ba7bea9df0950775f48918f63a8a (diff)
downloadspark-9cb64b2c54b35eed373f54c2103f679b04e9af1e.tar.gz
spark-9cb64b2c54b35eed373f54c2103f679b04e9af1e.tar.bz2
spark-9cb64b2c54b35eed373f54c2103f679b04e9af1e.zip
SPARK-2166 - Listing of instances to be terminated before the prompt
Will list the EC2 instances before detroying the cluster. This was added because it can be scary to destroy EC2 instances without knowing which one will be impacted. Author: Jean-Martin Archer <jeanmartin.archer@pulseenergy.com> This patch had conflicts when merged, resolved by Committer: Patrick Wendell <pwendell@gmail.com> Closes #270 from j-martin/master and squashes the following commits: 826455f [Jean-Martin Archer] [SPARK-2611] Implementing recommendations 27b0a36 [Jean-Martin Archer] Listing of instances to be terminated before the prompt Will list the EC2 instances before detroying the cluster. This was added because it can be scary to destroy EC2 instances without knowing which one will be impacted.
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-xec2/spark_ec2.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index a40311d9fc..e80f928b8b 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -770,12 +770,16 @@ def real_main():
setup_cluster(conn, master_nodes, slave_nodes, opts, True)
elif action == "destroy":
- response = raw_input("Are you sure you want to destroy the cluster " +
- cluster_name + "?\nALL DATA ON ALL NODES WILL BE LOST!!\n" +
- "Destroy cluster " + cluster_name + " (y/N): ")
+ print "Are you sure you want to destroy the cluster %s?" % cluster_name
+ print "The following instances will be terminated:"
+ (master_nodes, slave_nodes) = get_existing_cluster(
+ conn, opts, cluster_name, die_on_error=False)
+ for inst in master_nodes + slave_nodes:
+ print "> %s" % inst.public_dns_name
+
+ msg = "ALL DATA ON ALL NODES WILL BE LOST!!\nDestroy cluster %s (y/N): " % cluster_name
+ response = raw_input(msg)
if response == "y":
- (master_nodes, slave_nodes) = get_existing_cluster(
- conn, opts, cluster_name, die_on_error=False)
print "Terminating master..."
for inst in master_nodes:
inst.terminate()