You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/07 02:34:43 UTC

svn commit: r1347218 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/php/orchestrator/Cluster.php

Author: vikram
Date: Thu Jun  7 00:34:42 2012
New Revision: 1347218

URL: http://svn.apache.org/viewvc?rev=1347218&view=rev
Log:
AMBARI-415. Reset service back to original state after reconfiguration (Contributed by Hitesh)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1347218&r1=1347217&r2=1347218&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Thu Jun  7 00:34:42 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-415. Reset service back to original state after reconfiguration (Hitesh via Vikram)
+
   AMBARI-414. Add rpm spec for hmc agent. (Mahadev via Vikram)
 
   AMBARI-409. Uninstall does not get full list of hosts. (Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php?rev=1347218&r1=1347217&r2=1347218&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php Thu Jun  7 00:34:42 2012
@@ -863,11 +863,14 @@ class Cluster {
     }
 
     $services = $result["services"];
+    $servicesToSetToStoppedState = array();
 
     $svcsToStart = array();
     foreach ($services as $svcObj) {
       if ($svcObj->state == STATE::STARTED || $svcObj->state == STATE::STARTING) {
         array_push($svcsToStart, $svcObj->name);
+      } else if ($svcObj->state == STATE::STOPPED) {
+        array_push($servicesToSetToStoppedState, $svcObj->name);
       }
     }
 
@@ -888,6 +891,8 @@ class Cluster {
         array_push($services, $svc);
         if ($svc->state == STATE::STARTED || $svc->state == STATE::STARTING) {
           array_push($svcsToStart, $serviceName);
+        } else if ($svc->state == STATE::STOPPED) {
+          array_push($servicesToSetToStoppedState, $serviceName);
         }
       }
     }
@@ -937,6 +942,15 @@ class Cluster {
       }
     }
 
+    // Set the originally stopped services back to stopped state
+    foreach ($servicesToSetToStoppedState as $serviceName) {
+      $service = $this->db->getService($serviceName);
+      $this->logger->log_info("Setting state to STOPPED for service "
+          . $service->name);
+      $service->setState(STATE::STOPPED,
+          $transaction->createSubTransaction(), $dryRun, FALSE);
+    }
+
     if ($restartNagios) {
       $this->logger->log_info("Restarting Nagios Server after reconfiguration");
       $result = $this->_restartDashboardAndNagios(