in lib/muchos/ec2.py [0:0]
def terminate(self):
nodes = self.active_nodes()
print(
"The following {0} nodes in {1} cluster "
"will be terminated:".format(len(nodes), self.config.cluster_name)
)
self.print_nodes(nodes)
response = input("Do you want to continue? (y/n) ")
if response == "y":
ec2 = boto3.client("ec2")
for node in nodes:
ec2.terminate_instances(InstanceIds=[node["InstanceId"]])
print("Terminated nodes.")
if not self.config.has_option("ec2", "security_group_id"):
self.delete_security_group()
if path.isfile(self.config.hosts_path):
os.remove(self.config.hosts_path)
print("Removed hosts file at ", self.config.hosts_path)
else:
print("Aborted termination")