uninstallUtil.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. include_once '../util/Logger.php';
  3. include_once '../conf/Config.inc';
  4. include_once 'localDirs.php';
  5. include_once "../util/lock.php";
  6. include_once '../db/HMCDBAccessor.php';
  7. include_once 'commandUtils.php';
  8. function handleUninstallTransaction ($clusterName, $deployUser, $rootTxnId,
  9. $mySubTxnId, $parentSubTxnId, $hostsStr,
  10. $operationName, $cmdLine, $dbAccessor,
  11. $logger) {
  12. $opStatus = "STARTED";
  13. $subTransactionReturnValue = $dbAccessor->updateSubTransactionOpStatus($clusterName, $parentSubTxnId, $mySubTxnId, $opStatus);
  14. if ($subTransactionReturnValue["result"] != 0 ) {
  15. $logger->log_error("Got error while updating subTxn: ".$subTransactionReturnValue["error"]);
  16. print json_encode($subTransactionReturnValue);
  17. return;
  18. }
  19. runPdsh($clusterName, $operationName, $deployUser, $hostsStr, $cmdLine);
  20. $retArr = parseAndUpdateNodeInfo($clusterName, $operationName, $logger);
  21. $allHosts = $retArr["allHosts"];
  22. $finalOpStatus = $retArr["finalOpStatus"];
  23. // Perisist the data to the db.
  24. $returnValue = $dbAccessor->addHostsToCluster($clusterName, $allHosts);
  25. if ($returnValue["result"] != 0 ) {
  26. $logger->log_error("Got error while adding hosts: ".$returnValue["error"]);
  27. print json_encode($returnValue);
  28. return;
  29. }
  30. $subTransactionReturnValue = $dbAccessor->updateSubTransactionOpStatus($clusterName, $parentSubTxnId, $mySubTxnId, $finalOpStatus);
  31. if ($subTransactionReturnValue["result"] != 0 ) {
  32. $logger->log_error("Got error while updating subTxn: ".$subTransactionReturnValue["error"]);
  33. print json_encode($subTransactionReturnValue);
  34. return;
  35. }
  36. }
  37. ?>