listClusters.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. include 'dbLib.php';
  3. include 'gsInstallerUtils.php';
  4. $listOfClusters = array();
  5. if ($handle = opendir(getAllClustersDir())) {
  6. while (($clusterId = readdir($handle)) !== FALSE) {
  7. if ($clusterId != "." && $clusterId != "..") {
  8. // Return clusterId only if the deploy has started
  9. // if(hasInstallStarted($clusterId)) {
  10. // array_push($listOfClusters, $clusterId);
  11. $status = getClusterStatus($clusterId);
  12. global $CLUSTER_STATUS_INSTALL_IN_PROGRESS;
  13. global $CLUSTER_STATUS_INSTALL_DONE;
  14. global $CLUSTER_STATUS_INSTALL_SUCCESSFUL;
  15. global $CLUSTER_STATUS_INSTALL_UNSUCCESSFUL;
  16. if ($status == $CLUSTER_STATUS_INSTALL_IN_PROGRESS) {
  17. if (isGsInstallDone($clusterId)) {
  18. setClusterStatus($clusterId, $CLUSTER_STATUS_INSTALL_DONE);
  19. }
  20. }
  21. $listOfClusters[$clusterId] = getClusterStatus($clusterId);
  22. // $listOfClusters[$clusterId] = "started";//getClusterStatus($clusterId);
  23. //}
  24. }
  25. }
  26. closedir($handle);
  27. }
  28. header("Content-type: application/json");
  29. //print (json_encode($listOfClusters));
  30. print (json_encode($listOfClusters));
  31. ?>