You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by js...@apache.org on 2014/05/16 22:29:06 UTC

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

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.0 5d73d24f6 -> 15a8de575


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/15a8de57
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/15a8de57
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/15a8de57

Branch: refs/heads/branch-1.6.0
Commit: 15a8de575379df8b260bdc31e1a2a6b2fd65b209
Parents: 5d73d24
Author: John Speidel <js...@hortonworks.com>
Authored: Fri May 16 13:31:17 2014 -0400
Committer: John Speidel <js...@hortonworks.com>
Committed: Fri May 16 16:09:07 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/15a8de57/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 8b6c39a..bf64276 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
@@ -888,7 +888,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/15a8de57/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/15a8de57/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 f8bb351..f85079e 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
@@ -430,11 +430,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());
@@ -1500,11 +1499,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/15a8de57/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);
   }