This is an automated email from the ASF dual-hosted git repository.

arvindsh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo-muchos.git


The following commit(s) were added to refs/heads/master by this push:
     new 5360302  Fix wipe command for cluster_type 'existing' (#339)
5360302 is described below

commit 536030294965a74fa7aa0b18841af2562a1406eb
Author: Arvind Shyamsundar <[email protected]>
AuthorDate: Mon Apr 13 10:01:56 2020 -0700

    Fix wipe command for cluster_type 'existing' (#339)
    
    * Call wipe.yml for existing clusters as well
    * Minor refactor of associated wipe() methods
---
 lib/muchos/azure.py    |  2 +-
 lib/muchos/ec2.py      |  2 +-
 lib/muchos/existing.py | 11 +++++++----
 3 files changed, 9 insertions(+), 6 deletions(-)

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 @@ class VmssCluster(ExistingCluster):
             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 @@ class Ec2Cluster(ExistingCluster):
             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 @@ class ExistingCluster:
             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 @@ class ExistingCluster:
         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):

Reply via email to