浏览代码

AMBARI-435. Uninstall needs to update status for failure. (Contributed by Vikram)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/ambari-186@1347239 13f79535-47bb-0310-9956-ffa450edef68
Vikram Dixit K 13 年之前
父节点
当前提交
ea310871d8
共有 4 个文件被更改,包括 22 次插入4 次删除
  1. 2 0
      CHANGES.txt
  2. 4 4
      hmc/php/frontend/deployPostProcess.php
  3. 1 0
      hmc/php/frontend/fetchTxnProgress.php
  4. 15 0
      hmc/php/frontend/uninstallCleanup.php

+ 2 - 0
CHANGES.txt

@@ -6,6 +6,8 @@ characters wide.
 
 
 Release 0.1.x - unreleased
 Release 0.1.x - unreleased
 
 
+  AMBARI-435. Uninstall needs to update status for failure. (Vikram)
+
   AMBARI-434. fix display name in smoke test progress description (Hitesh via Vikram)
   AMBARI-434. fix display name in smoke test progress description (Hitesh via Vikram)
 
 
   AMBARI-433. Using service stop instead of killall for uninstall (Vikram)
   AMBARI-433. Using service stop instead of killall for uninstall (Vikram)

+ 4 - 4
hmc/php/frontend/deployPostProcess.php

@@ -19,11 +19,11 @@ function deployPostProcess($clusterName, $user, $txnId, $progress)
   $result = 0;
   $result = 0;
   $error = "";
   $error = "";
 
 
-  $txnStatus = $dbAccessor->getTransactionStatusInfo($clusterName, $txnId);
-  if ($txnStatus['result'] != 0) {
+  $txnStatusInfo = $dbAccessor->getTransactionStatusInfo($clusterName, $txnId);
+  if ($txnStatusInfo['result'] != 0) {
     $logger->log_error("Deploy post process get txn info failed");
     $logger->log_error("Deploy post process get txn info failed");
-    $result = $txnStatus['result'];
-    $error = $txnStatus['error'];
+    $result = $txnStatusInfo['result'];
+    $error = $txnStatusInfo['error'];
     return (array("result" => $result, "error" => $error));
     return (array("result" => $result, "error" => $error));
   }
   }
 
 

+ 1 - 0
hmc/php/frontend/fetchTxnProgress.php

@@ -711,6 +711,7 @@ if (($progress['processRunning'] == FALSE) || ($progress['encounteredError'] ==
       $retval = $postProcessFunc($clusterName, $deployUser, $txnId, $progress);
       $retval = $postProcessFunc($clusterName, $deployUser, $txnId, $progress);
       if ($retval["result"] != 0) {
       if ($retval["result"] != 0) {
         $progress['encounteredError'] = TRUE;
         $progress['encounteredError'] = TRUE;
+        $lastTransaction['progress'] = "FAILED";
         break;
         break;
       }
       }
     }
     }

+ 15 - 0
hmc/php/frontend/uninstallCleanup.php

@@ -21,6 +21,21 @@ function deBootStrap ($clusterName, $deployUser, $txnId, $progressInfo)
 {
 {
   global $logger, $dbAccessor, $stagesInfo;
   global $logger, $dbAccessor, $stagesInfo;
 
 
+  $txnStatus = !($progressInfo['encounteredError']);
+
+  // do not go ahead with the cleanup. 
+  // Update the state of the cluster.
+  if (!$txnStatus) {
+    $state = "UNINSTALLED";
+    $displayName = "Uninstall failed";
+    $context = array (
+      'status' => $txnStatus,
+      'txnId' => $txnId
+    );
+    $retval = updateClusterState($clusterName, $state, $displayName, $context);
+    return $retval;
+  }
+
   /////// launch the stages in the background.
   /////// launch the stages in the background.
   $stagesFile = "./uninstall/stages.php";
   $stagesFile = "./uninstall/stages.php";
   $logger->log_debug("ClusterName: $clusterName\n");
   $logger->log_debug("ClusterName: $clusterName\n");