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:42 UTC

[1/2] ambari git commit: AMBARI-13771. Password type property saved with empty value should not be encrypted and auto-filled (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 2e00358cb -> 5f52c1142
  refs/heads/trunk 1317c8f17 -> d6c7038b8


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

Branch: refs/heads/branch-2.1
Commit: 5f52c1142c5767bbd812937076740189625d2693
Parents: 2e00358
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:11:46 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/5f52c114/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/5f52c114/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 394bae4..38231cd 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
@@ -10593,6 +10593,7 @@ public class AmbariManagementControllerTest {
         "version1",
         new HashMap<String, String>(){{
           put("test.password", "first");
+          put("test.password.empty", "");
         }},
         new HashMap<String, Map<String, String>>()
     );
@@ -10695,6 +10696,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/5f52c114/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>


[2/2] ambari git commit: AMBARI-13771. Password type property saved with empty value should not be encrypted and auto-filled (dlysnichenko)

Posted by dm...@apache.org.
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>