Fix wipe command for cluster_type 'existing' (#339)
* Call wipe.yml for existing clusters as well
* Minor refactor of associated wipe() methods
diff --git a/lib/muchos/azure.py b/lib/muchos/azure.py
index 075778b..d6ac740 100644
--- a/lib/muchos/azure.py
+++ b/lib/muchos/azure.py
@@ -74,7 +74,7 @@
print("Aborted termination")
def wipe(self):
- self.execute_playbook("wipe.yml")
+ super().wipe()
# Wipe ADLS Gen2 storage accounts if implemented
config = self.config
azure_config = dict(config.items("azure"))
diff --git a/lib/muchos/ec2.py b/lib/muchos/ec2.py
index e7fc78c..a572b59 100644
--- a/lib/muchos/ec2.py
+++ b/lib/muchos/ec2.py
@@ -240,7 +240,7 @@
print("Aborted termination")
def wipe(self):
- self.execute_playbook("wipe.yml")
+ super().wipe()
class Ec2ClusterTemplate(Ec2Cluster):
diff --git a/lib/muchos/existing.py b/lib/muchos/existing.py
index 312a5a8..310afba 100644
--- a/lib/muchos/existing.py
+++ b/lib/muchos/existing.py
@@ -217,6 +217,13 @@
cmd=cmd, src=path, usr=self.config.get('general', 'cluster_user'), ldr=self.config.get_proxy_ip(),
tdir=target), shell=True)
+ def wipe(self):
+ if not isfile(self.config.hosts_path):
+ exit("Hosts file does not exist for cluster: " + self.config.hosts_path)
+ print("Killing all processes started by Muchos and wiping Muchos data from {0} cluster"
+ .format(self.config.cluster_name))
+ self.execute_playbook("wipe.yml")
+
def perform(self, action):
if action == 'launch':
self.launch()
@@ -229,10 +236,6 @@
elif action == 'ssh':
self.ssh()
elif action == 'wipe':
- if not isfile(self.config.hosts_path):
- exit("Hosts file does not exist for cluster: " + self.config.hosts_path)
- print("Killing all processes started by Muchos and wiping Muchos data from {0} cluster"
- .format(self.config.cluster_name))
self.wipe()
elif action in ('kill', 'cancel_shutdown'):
if not isfile(self.config.hosts_path):