You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/11/06 16:13:43 UTC
[2/2] ambari git commit: AMBARI-13771. Password type property saved
with empty value should not be encrypted and auto-filled (dlysnichenko)
AMBARI-13771. Password type property saved with empty value should not be encrypted and auto-filled (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6c7038b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6c7038b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6c7038b
Branch: refs/heads/trunk
Commit: d6c7038b8132b9c66ac34aa3b00a944f752a984c
Parents: 1317c8f
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Fri Nov 6 17:11:46 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Fri Nov 6 17:13:41 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/ambari/server/utils/SecretReference.java | 6 ++++--
.../server/controller/AmbariManagementControllerTest.java | 4 ++++
.../stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml | 6 ++++++
3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6c7038b/ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java
index d801975..6cfe53c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java
@@ -108,8 +108,10 @@ public class SecretReference {
if(propertiesTypes != null && propertiesTypes.containsKey(PropertyInfo.PropertyType.PASSWORD)) {
for(String pwdPropertyName: propertiesTypes.get(PropertyInfo.PropertyType.PASSWORD)) {
if(propertiesMap.containsKey(pwdPropertyName)){
- String stub = SecretReference.generateStub(configType, configVersion, pwdPropertyName);
- propertiesMap.put(pwdPropertyName, stub);
+ if(!propertiesMap.get(pwdPropertyName).equals("")) {
+ String stub = SecretReference.generateStub(configType, configVersion, pwdPropertyName);
+ propertiesMap.put(pwdPropertyName, stub);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6c7038b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 8d43349..f216e02 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -10590,6 +10590,7 @@ public class AmbariManagementControllerTest {
"version1",
new HashMap<String, String>(){{
put("test.password", "first");
+ put("test.password.empty", "");
}},
new HashMap<String, Map<String, String>>()
);
@@ -10692,6 +10693,9 @@ public class AmbariManagementControllerTest {
if(resp.getConfigs().containsKey("test.password")) {
assertEquals(resp.getConfigs().get("test.password"), secretName);
}
+ if(resp.getConfigs().containsKey("test.password.empty")) {
+ assertEquals(resp.getConfigs().get("test.password.empty"), "");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6c7038b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml
index f53c667..680a35f 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HDFS/configuration/hdfs-site.xml
@@ -29,6 +29,12 @@
<value>test</value>
<description>1</description>
</property>
+ <property>
+ <name>test.password.empty</name>
+ <property-type>PASSWORD</property-type>
+ <value></value>
+ <description>1</description>
+ </property>
<property>
<name>dfs.namenode.name.dir</name>