incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgog...@apache.org
Subject svn commit: r1225751 - /incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
Date Fri, 30 Dec 2011 03:59:34 GMT
Author: vgogate
Date: Fri Dec 30 03:59:34 2011
New Revision: 1225751

URL: http://svn.apache.org/viewvc?rev=1225751&view=rev
Log:
AMBARI-179. Set the component level user/group information in the flattened stack, inherit
default user/group information if not set one for component.

Modified:
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java

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=1225751&r1=1225750&r2=1225751&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
Fri Dec 30 03:59:34 2011
@@ -917,18 +917,29 @@ public class Clusters {
       String config = "\n";
       config = config + "$ambari_cluster_name" + " = " + "\"" + c.getName() + "\"\n";
       config = config + "\n";
+      /*
+       * TODO: Add all master host names
+      */
+      HashMap<String, String> roles = new HashMap<String, String>();
       for (RoleToNodes rns : c.getRoleToNodesMap()) {
           config = config + "$ambari_"+rns.getRoleName()+"_host" + " = " + "\"";
+          roles.put(rns.getRoleName(), null);
           List<String> host_list = this.getHostnamesFromRangeExpressions(rns.getNodes());
-          for (int j=0; j<host_list.size(); j++) {
-              String host = host_list.get(j);
-              if (j == host_list.size()-1) {
-                  config = config + host;
-              } else {
-                  config = config +host+", ";
+          if (host_list != null && host_list.get(0) != null) {
+            config = config + host_list.get(0);
+          }  
+          config = config + "\"\n";
+      }
+     
+      /* 
+       * Add non-specified roles for puppet to work correctly
+       */
+      for (Component comp : stack.getComponents()) {
+          for (Role r : comp.getRoles()) {
+              if (!roles.containsKey(r.getName())) {
+                  config = config + "$ambari_"+r.getName()+"_host" + " = " + "\"\"\n";
               }
           }
-          config = config + "\"\n";
       }
       config = config + "\n";
       
@@ -987,9 +998,7 @@ public class Clusters {
   }
   
   private String getRoleToNodesMapForPuppet (ClusterDefinition c, Stack stack) throws Exception
{
-      /*
-       * TODO: Add all master host names
-       */
+  
       HashMap<String, String> roles = new HashMap<String, String>();
       String config = "\n$role_to_nodes = { ";
       for (int i=0; i<c.getRoleToNodesMap().size(); i++) {



Mime
View raw message