You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/07/05 20:45:30 UTC
svn commit: r1357798 - in /incubator/ambari/trunk: CHANGES.txt
hmc/php/db/OrchestratorDB.php hmc/php/orchestrator/Cluster.php
hmc/php/orchestrator/Service.php hmc/php/orchestrator/ServiceComponent.php
Author: hitesh
Date: Thu Jul 5 18:45:29 2012
New Revision: 1357798
URL: http://svn.apache.org/viewvc?rev=1357798&view=rev
Log:
AMBARI-598. Set state to UNKNOWN and not 0 to avoid issues when using === matches (Contributed by Hitesh)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/hmc/php/db/OrchestratorDB.php
incubator/ambari/trunk/hmc/php/orchestrator/Cluster.php
incubator/ambari/trunk/hmc/php/orchestrator/Service.php
incubator/ambari/trunk/hmc/php/orchestrator/ServiceComponent.php
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1357798&r1=1357797&r2=1357798&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Jul 5 18:45:29 2012
@@ -6,6 +6,9 @@ characters wide.
Release 1.0.0 - unreleased
+ AMBARI-598. Set state to UNKNOWN and not 0 to avoid issues when using === matches
+ (hitesh)
+
AMBARI-599. Welcome page - revive introductory message (yusaku)
AMBARI-589. Refactor progress popup (TxnProgressWidget) Javascript code
Modified: incubator/ambari/trunk/hmc/php/db/OrchestratorDB.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/db/OrchestratorDB.php?rev=1357798&r1=1357797&r2=1357798&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/db/OrchestratorDB.php (original)
+++ incubator/ambari/trunk/hmc/php/db/OrchestratorDB.php Thu Jul 5 18:45:29 2012
@@ -125,7 +125,7 @@ class OrchestratorDB {
$this->logger->log_error("Found service with invalid state"
. ", service=" . $svc["serviceName"]
. ", state=" . $svc["state"]);
- $state = 0; // unknown
+ $state = STATE::UNKNOWN; // unknown
}
$svcObj =
@@ -155,6 +155,12 @@ class OrchestratorDB {
}
$state = STATE::getStateFromString($serviceInfo["state"]);
+ if ($state === FALSE) {
+ $this->logger->log_error("Found service with invalid state"
+ . ", service=" . $serviceName
+ . ", state=" . $serviceInfo["state"]);
+ $state = STATE::UNKNOWN; // unknown
+ }
return $this->getServiceObj($serviceName, $state, $this, $this->puppet);
}
@@ -200,7 +206,7 @@ class OrchestratorDB {
$this->logger->log_error("Found service with invalid state"
. ", service=" . $svc["serviceName"]
. ", state=" . $svc["state"]);
- $state = 0; // unknown
+ $state = STATE::UNKNOWN; // unknown
}
$svcObj =
@@ -243,7 +249,7 @@ class OrchestratorDB {
$this->logger->log_warn("Found service with invalid state"
. ", service=" . $svc["serviceName"]
. ", state=" . $svc["state"]);
- $state = 0; // unknown
+ $state = STATE::UNKNOWN; // unknown
}
$svcObj =
@@ -290,7 +296,7 @@ class OrchestratorDB {
$this->logger->log_warn("Found component with invalid state"
. ", component=" . $comp["componentName"]
. ", state=" . $comp["state"]);
- $state = 0;
+ $state = STATE::UNKNOWN;
}
$isClient = FALSE;
if (isset($fullCompList[$comp["componentName"]])) {
@@ -392,7 +398,7 @@ class OrchestratorDB {
$this->logger->log_error("Found component with invalid state"
. ", component=" . $comp["componentName"]
. ", state=" . $comp["state"]);
- $state = 0;
+ $state = STATE::UNKNOWN;
}
$isClient = FALSE;
if (isset($fullCompList[$comp["componentName"]])) {
@@ -464,7 +470,7 @@ class OrchestratorDB {
$this->logger->log_error("Found component with invalid state"
. ", component=" . $comp["componentName"]
. ", state=" . $comp["state"]);
- $state = 0;
+ $state = STATE::UNKNOWN;
}
$isClient = FALSE;
if (isset($fullCompList[$comp["componentName"]])) {
Modified: incubator/ambari/trunk/hmc/php/orchestrator/Cluster.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/orchestrator/Cluster.php?rev=1357798&r1=1357797&r2=1357798&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/orchestrator/Cluster.php (original)
+++ incubator/ambari/trunk/hmc/php/orchestrator/Cluster.php Thu Jul 5 18:45:29 2012
@@ -265,6 +265,9 @@ class Cluster {
$compInfo["state"] = "UNKNOWN";
}
$state = State::getStateFromString($compInfo["state"]);
+ if ($state === FALSE) {
+ $state = STATE::UNKNOWN;
+ }
if (!isset($hostCompMapping[$svcName][$compName]["state"])) {
$hostCompMapping[$svcName][$compName]["state"] = $state;
}
@@ -1030,7 +1033,7 @@ class Cluster {
$desc, TransactionProgress::$PROGRESS[$txnProgress],
"CLUSTER", $dryRun);
if ($result['result'] !== 0) {
- $this->state == State::FAILED;
+ $this->state = State::FAILED;
$this->logger->log_error($this->name." - ".State::$STATE[$state]);
return $result;
}
Modified: incubator/ambari/trunk/hmc/php/orchestrator/Service.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/orchestrator/Service.php?rev=1357798&r1=1357797&r2=1357798&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/orchestrator/Service.php (original)
+++ incubator/ambari/trunk/hmc/php/orchestrator/Service.php Thu Jul 5 18:45:29 2012
@@ -106,7 +106,7 @@ class Service {
$desc, TransactionProgress::$PROGRESS[$txnProgress],
"SERVICE", $dryRun);
if ($result['result'] !== 0) {
- $this->state == State::FAILED;
+ $this->state = State::FAILED;
$this->logger->log_error($this->name." - ".State::$STATE[$state]);
$this->logger->log_error("Failed to persist transaction: " . $transaction->toString());
$this->db->setServiceState($this, $state);
@@ -117,7 +117,7 @@ class Service {
if (!$dryRun) {
$result = $this->db->setServiceState($this, $state);
if ($result['result'] !== 0) {
- $this->state == State::FAILED;
+ $this->state = State::FAILED;
$this->logger->log_error("Failed to persist state for Service "
. "$this->name - ".State::$STATE[$state] . " dryRun=$dryRun");
$this->db->setServiceState($this, $state);
Modified: incubator/ambari/trunk/hmc/php/orchestrator/ServiceComponent.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/orchestrator/ServiceComponent.php?rev=1357798&r1=1357797&r2=1357798&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/orchestrator/ServiceComponent.php (original)
+++ incubator/ambari/trunk/hmc/php/orchestrator/ServiceComponent.php Thu Jul 5 18:45:29 2012
@@ -97,7 +97,7 @@ class ServiceComponent {
$desc, TransactionProgress::$PROGRESS[$txnProgress],
"SERVICECOMPONENT", $dryRun);
if ($result['result'] !== 0) {
- $this->state == State::FAILED;
+ $this->state = State::FAILED;
$this->logger->log_error("$this->name - ".State::$STATE[$state]);
$this->db->setServiceState($this, $state);
return $result;
@@ -107,7 +107,7 @@ class ServiceComponent {
if (!$dryRun) {
$result = $this->db->setServiceComponentState($this->serviceName, $this->name, $state);
if ($result['result'] !== 0) {
- $this->state == State::FAILED;
+ $this->state = State::FAILED;
$this->logger->log_error("$this->name - ".State::$STATE[$state]);
$this->db->setServiceState($this, $state);
return $result;