ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jspei...@apache.org
Subject git commit: AMBARI-5793. When provisioning cluster via a bluprint, in some cases not all missing passwords reported to user
Date Fri, 16 May 2014 21:47:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b88de637e -> 01a2fa555


AMBARI-5793.  When provisioning cluster via a bluprint, in some cases not all missing passwords
reported to user


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/01a2fa55
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/01a2fa55
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/01a2fa55

Branch: refs/heads/trunk
Commit: 01a2fa5555a956fc3cd59f878ba6645b79f6dc86
Parents: b88de63
Author: John Speidel <jspeidel@hortonworks.com>
Authored: Fri May 16 13:31:17 2014 -0400
Committer: John Speidel <jspeidel@hortonworks.com>
Committed: Fri May 16 17:47:27 2014 -0400

----------------------------------------------------------------------
 .../internal/ClusterResourceProvider.java       |  1 -
 .../server/orm/entities/BlueprintEntity.java    |  8 ++++--
 .../internal/ClusterResourceProviderTest.java   |  6 ++---
 .../orm/entities/BlueprintEntityTest.java       | 27 +++++++++++++++++---
 4 files changed, 31 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/01a2fa55/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index fdac274..8bd354a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -891,7 +891,6 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
     // AMBARI-4921
     ensureProperty("global", "user_group", "hadoop");
     ensureProperty("global", "nagios_contact", "default@REPLACEME.NOWHERE");
-    ensureProperty("global", "nagios_web_password", "admin");
     ensureProperty("global", "smokeuser", "ambari-qa");
 
     // AMBARI-5206

http://git-wip-us.apache.org/repos/asf/ambari/blob/01a2fa55/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
index cd764ec..7926fd4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
@@ -228,9 +228,13 @@ public class BlueprintEntity {
 
         requiredProperties.removeAll(operationalTypeProps);
         if (! requiredProperties.isEmpty()) {
-          Map<String, Collection<String>> hostGroupMissingProps = new HashMap<String,
Collection<String>>();
+          String hostGroupName = hostGroup.getName();
+          Map<String, Collection<String>> hostGroupMissingProps = missingProperties.get(hostGroupName);
+          if (hostGroupMissingProps == null) {
+            hostGroupMissingProps = new HashMap<String, Collection<String>>();
+            missingProperties.put(hostGroupName, hostGroupMissingProps);
+          }
           hostGroupMissingProps.put(requiredCategory, requiredProperties);
-          missingProperties.put(hostGroup.getName(), hostGroupMissingProps);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/01a2fa55/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
index 4b07873..901d55f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
@@ -434,11 +434,10 @@ public class ClusterResourceProviderTest {
     mapConfigRequests.put(cr3.getType(), cr3);
     assertEquals(3, mapConfigRequests.size());
     ConfigurationRequest globalConfigRequest = mapConfigRequests.get("global");
-    assertEquals(5, globalConfigRequest.getProperties().size());
+    assertEquals(4, globalConfigRequest.getProperties().size());
     assertEquals("hadoop", globalConfigRequest.getProperties().get("user_group"));
     assertEquals("ambari-qa", globalConfigRequest.getProperties().get("smokeuser"));
     assertEquals("default@REPLACEME.NOWHERE", globalConfigRequest.getProperties().get("nagios_contact"));
-    assertEquals("admin", globalConfigRequest.getProperties().get("nagios_web_password"));
     assertEquals("oozie", globalConfigRequest.getProperties().get("oozie_user"));
     ConfigurationRequest hdfsConfigRequest = mapConfigRequests.get("hdfs-site");
     assertEquals(1, hdfsConfigRequest.getProperties().size());
@@ -1504,11 +1503,10 @@ public class ClusterResourceProviderTest {
     mapConfigRequests.put(cr3.getType(), cr3);
     assertEquals(3, mapConfigRequests.size());
     ConfigurationRequest globalConfigRequest = mapConfigRequests.get("global");
-    assertEquals(5, globalConfigRequest.getProperties().size());
+    assertEquals(4, globalConfigRequest.getProperties().size());
     assertEquals("hadoop", globalConfigRequest.getProperties().get("user_group"));
     assertEquals("ambari-qa", globalConfigRequest.getProperties().get("smokeuser"));
     assertEquals("default@REPLACEME.NOWHERE", globalConfigRequest.getProperties().get("nagios_contact"));
-    assertEquals("admin", globalConfigRequest.getProperties().get("nagios_web_password"));
     assertEquals("oozie", globalConfigRequest.getProperties().get("oozie_user"));
     ConfigurationRequest hdfsConfigRequest = mapConfigRequests.get("hdfs-site");
     assertEquals(1, hdfsConfigRequest.getProperties().size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/01a2fa55/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/BlueprintEntityTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/BlueprintEntityTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/BlueprintEntityTest.java
index cff9aad..de104e7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/BlueprintEntityTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/BlueprintEntityTest.java
@@ -89,7 +89,7 @@ public class BlueprintEntityTest {
     prop.setRequireInput(true);
     prop.setType(PropertyInfo.PropertyType.PASSWORD);
     prop.setValue(null);
-    requiredProps.put("service1", prop);
+    requiredProps.put("super.secret.password", prop);
 
     BlueprintEntity entity = new BlueprintEntity();
     entity.setStackName("stackName");
@@ -112,6 +112,7 @@ public class BlueprintEntityTest {
 
     Collection<HostGroupEntity> hostGroupEntities = new HashSet<HostGroupEntity>();
     HostGroupEntity hostGroupEntity = new HostGroupEntity();
+    hostGroupEntity.setName("group1");
     Collection<HostGroupComponentEntity> hostGroupComponents = new HashSet<HostGroupComponentEntity>();
     HostGroupComponentEntity componentEntity = new HostGroupComponentEntity();
     componentEntity.setName("component1");
@@ -148,7 +149,7 @@ public class BlueprintEntityTest {
     prop.setRequireInput(true);
     prop.setType(PropertyInfo.PropertyType.PASSWORD);
     prop.setValue(null);
-    requiredProps.put("service1", prop);
+    requiredProps.put("super.secret.password", prop);
 
     BlueprintEntity entity = new BlueprintEntity();
     entity.setStackName("stackName");
@@ -158,6 +159,7 @@ public class BlueprintEntityTest {
 
     Collection<HostGroupEntity> hostGroupEntities = new HashSet<HostGroupEntity>();
     HostGroupEntity hostGroupEntity = new HostGroupEntity();
+    hostGroupEntity.setName("group1");
     Collection<HostGroupComponentEntity> hostGroupComponents = new HashSet<HostGroupComponentEntity>();
     HostGroupComponentEntity componentEntity = new HostGroupComponentEntity();
     componentEntity.setName("component1");
@@ -208,7 +210,16 @@ public class BlueprintEntityTest {
     prop.setRequireInput(true);
     prop.setType(PropertyInfo.PropertyType.PASSWORD);
     prop.setValue(null);
-    requiredProps.put("service1", prop);
+
+    PropertyInfo prop2 = new PropertyInfo();
+    prop2.setFilename("global.xml");
+    prop2.setName("another.super.secret.password");
+    prop2.setRequireInput(true);
+    prop2.setType(PropertyInfo.PropertyType.PASSWORD);
+    prop2.setValue(" ");
+
+    requiredProps.put("super.secret.password", prop);
+    requiredProps.put("another.super.secret.password", prop2);
 
     BlueprintEntity entity = new BlueprintEntity();
     entity.setStackName("stackName");
@@ -231,12 +242,13 @@ public class BlueprintEntityTest {
 
     Collection<HostGroupEntity> hostGroupEntities = new HashSet<HostGroupEntity>();
     HostGroupEntity hostGroupEntity = new HostGroupEntity();
+    hostGroupEntity.setName("hg1");
     Collection<HostGroupComponentEntity> hostGroupComponents = new HashSet<HostGroupComponentEntity>();
     HostGroupComponentEntity componentEntity = new HostGroupComponentEntity();
     componentEntity.setName("component1");
     componentEntity.setBlueprintName("blueprint");
     componentEntity.setHostGroupEntity(hostGroupEntity);
-    componentEntity.setHostGroupName("group1");
+    componentEntity.setHostGroupName("hg1");
     hostGroupComponents.add(componentEntity);
     hostGroupEntity.setComponents(hostGroupComponents);
     hostGroupEntity.setConfigurations(Collections.<HostGroupConfigEntity>emptyList());
@@ -252,6 +264,13 @@ public class BlueprintEntityTest {
         metaInfo, PropertyInfo.PropertyType.PASSWORD);
 
     assertEquals(1, missingProps.size());
+    Map<String, Collection<String>> typeProps = missingProps.get("hg1");
+    assertEquals(2, typeProps.size());
+    assertEquals(1, typeProps.get("global").size());
+    assertEquals(1, typeProps.get("core-site").size());
+
+    assertTrue(typeProps.get("core-site").contains("super.secret.password"));
+    assertTrue(typeProps.get("global").contains("another.super.secret.password"));
 
     verify(metaInfo);
   }


Mime
View raw message