incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgog...@apache.org
Subject svn commit: r1186597 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/client/ controller/src/main/java/org/apache/ambari/controller/
Date Thu, 20 Oct 2011 01:33:48 GMT
Author: vgogate
Date: Thu Oct 20 01:33:48 2011
New Revision: 1186597

URL: http://svn.apache.org/viewvc?rev=1186597&view=rev
Log:
AMBARI-88

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterNodes.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1186597&r1=1186596&r2=1186597&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Oct 20 01:33:48 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-88. Update cluster nodes reservation is giving null pointer exception during cluster
creation (vgogate)
+
   AMBARI-87. Importing pre-existing blueprint to Ambari through CLI "blueprint add" gives
wrong error message (vgogate)
 
   AMBARI-86. Validate blueprint referenced by cluster exist including it's parent blueprints
(vgogate)

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterNodes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterNodes.java?rev=1186597&r1=1186596&r2=1186597&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterNodes.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterNodes.java
Thu Oct 20 01:33:48 2011
@@ -165,7 +165,7 @@ public class ClusterNodes extends Comman
          */
         List<Node> nodes = response.getEntity(new GenericType<List<Node>>(){});
         
-        System.out.println("List of associated nodes: \n");
+        System.out.println("List of cluster nodes: \n");
         for (Node node : nodes ) {
             printNodeInformation(node);
             System.out.println("\n");

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java?rev=1186597&r1=1186596&r2=1186597&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
Thu Oct 20 01:33:48 2011
@@ -282,7 +282,7 @@ public class Blueprints {
         /*
          * Validate the blueprint
          */
-        validateDefaultBlueprint(bp);
+        validateBlueprint(bp);
         
         if (blueprints.containsKey(bp.getName())) {
             if (blueprints.get(bp.getName()).containsKey(new Integer(bp.getRevision())))
{
@@ -326,14 +326,26 @@ public class Blueprints {
     }
    
     /*
-     * Validate the default blueprint before importing into stack.
+     * Validate the blueprint before importing into controller
      */
-    public void validateDefaultBlueprint(Blueprint blueprint) throws WebApplicationException
{
+    public void validateBlueprint(Blueprint blueprint) throws WebApplicationException {
         
         if (blueprint.getName() == null || blueprint.getName().equals("")) {
             String msg = "Blueprint must be associated with non-empty name";
             throw new WebApplicationException ((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
         }
+        if (blueprint.getRevision() == null || blueprint.getRevision().equals("") ||
+            blueprint.getRevision().equalsIgnoreCase("null")) {
+            blueprint.setRevision("-1");
+        }
+        if (blueprint.getParentName() != null && 
+            (blueprint.getParentName().equals("") || blueprint.getParentName().equalsIgnoreCase("null")))
{
+            blueprint.setParentName(null);
+        }
+        if (blueprint.getParentRevision() == null || blueprint.getParentRevision().equals("")
||
+            blueprint.getParentRevision().equalsIgnoreCase("null")) {
+            blueprint.setParentRevision("-1");
+        }
     }
     
     /*

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java?rev=1186597&r1=1186596&r2=1186597&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
Thu Oct 20 01:33:48 2011
@@ -412,7 +412,8 @@ public class Clusters {
          */    
         List<String> nodes_currently_allocated_to_cluster = new ArrayList<String>();
         for (Node n : Nodes.getInstance().getNodes().values()) {
-            if (n.getNodeState().getClusterID().equals(clusterID)) {
+            if ( n.getNodeState().getClusterID() != null &&
+                 n.getNodeState().getClusterID().equals(clusterID)) {
                 nodes_currently_allocated_to_cluster.add(n.getName());
             }
         }



Mime
View raw message