Browse Source

AMBARI-452. Create cluster should wipe out entire db (Contributed by Vikram)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/ambari-186@1347259 13f79535-47bb-0310-9956-ffa450edef68
Vikram Dixit K 13 years ago
parent
commit
73fb735b96
3 changed files with 13 additions and 2 deletions
  1. 2 0
      CHANGES.txt
  2. 10 1
      hmc/php/db/HMCDBAccessor.php
  3. 1 1
      hmc/php/frontend/createCluster.php

+ 2 - 0
CHANGES.txt

@@ -6,6 +6,8 @@ characters wide.
 
 
 Release 0.1.x - unreleased
 Release 0.1.x - unreleased
 
 
+  AMBARI-452. Create cluster should wipe out entire db (Vikram)
+
   AMBARI-451. Add nodes has incorrect check on returned status (Vikram)
   AMBARI-451. Add nodes has incorrect check on returned status (Vikram)
 
 
   AMBARI-450. Boldify/Redify restart HMC message when nagios/ganglia is on the hmc host (Yusaku via Vikram)
   AMBARI-450. Boldify/Redify restart HMC message when nagios/ganglia is on the hmc host (Yusaku via Vikram)

+ 10 - 1
hmc/php/db/HMCDBAccessor.php

@@ -3311,10 +3311,19 @@ class HMCDBAccessor {
   }
   }
 
 
   public function cleanupCluster ($clusterName) {
   public function cleanupCluster ($clusterName) {
-    $this->deleteAllInTable("Clusters");
+//    $this->deleteAllInTable("Clusters");
     $this->deleteClusterTable($clusterName, "ServiceComponentInfo");
     $this->deleteClusterTable($clusterName, "ServiceComponentInfo");
     $this->cleanupHosts($clusterName);
     $this->cleanupHosts($clusterName);
   }
   }
 
 
+  public function wipeOutClusters () {
+    $this->deleteAllInTable("Clusters");
+    $this->deleteAllInTable("ServiceComponentInfo");
+    $this->deleteAllInTable("Hosts");
+    $this->deleteAllInTable("HostRoles");
+    $this->deleteAllInTable("ServiceConfig");
+    $this->deleteAllInTable("ServiceInfo");
+  }
+
 }
 }
 ?>
 ?>

+ 1 - 1
hmc/php/frontend/createCluster.php

@@ -60,7 +60,7 @@ if ($fileHdl == false) {
 fclose($fileHdl);
 fclose($fileHdl);
 
 
 // if user re-enters this page, we need to delete and restart the cluster conf
 // if user re-enters this page, we need to delete and restart the cluster conf
-$dbAccessor->cleanupCluster($clusterName);
+$dbAccessor->wipeOutClusters($clusterName);
 $logger->log_debug("Completed deletion of cluster: ".$clusterName);
 $logger->log_debug("Completed deletion of cluster: ".$clusterName);
 
 
 $hdpVersion="1.0"; // TODO: hardcoded
 $hdpVersion="1.0"; // TODO: hardcoded