ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-17223. Ability to add "javax.jdo.option.ConnectionPassword" to hive clients from ambari (aonishuk)
Date Fri, 15 Jul 2016 12:01:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 bf9510ee2 -> 2d636c97a
  refs/heads/trunk 6be4f5aac -> e70586842


AMBARI-17223. Ability to add "javax.jdo.option.ConnectionPassword" to hive clients from ambari
(aonishuk)


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

Branch: refs/heads/trunk
Commit: e70586842cec2e65e32bf28b043f93ef257f78fd
Parents: 6be4f5a
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Jul 15 14:53:03 2016 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Jul 15 14:53:03 2016 +0300

----------------------------------------------------------------------
 .../server/actionmanager/ActionScheduler.java   | 10 +---
 .../AmbariManagementControllerImpl.java         | 28 ++++++-----
 .../internal/ClientConfigResourceProvider.java  |  9 ++--
 .../ambari/server/state/ConfigHelper.java       | 51 ++++++++++++++++++++
 .../apache/ambari/server/state/StackInfo.java   | 39 +++++++++++++++
 .../server/state/ValueAttributesInfo.java       | 14 ++++++
 .../HIVE/0.12.0.2.0/configuration/hive-site.xml |  1 +
 .../src/main/resources/configuration-schema.xsd |  1 +
 .../services/HIVE/configuration/hive-site.xml   |  1 +
 .../services/HIVE/configuration/hive-site.xml   |  1 +
 .../ambari/server/state/ConfigHelperTest.java   | 45 +++++++++++++++++
 .../services/HIVE/configuration/hive-site.xml   |  5 ++
 12 files changed, 183 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index bf2ff38..205ef9f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -50,6 +50,7 @@ import org.apache.ambari.server.orm.entities.RequestEntity;
 import org.apache.ambari.server.serveraction.ServerActionExecutor;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.Service;
@@ -328,14 +329,7 @@ class ActionScheduler implements Runnable {
         //Schedule what we have so far
 
         for (ExecutionCommand cmd : commandsToSchedule) {
-
-          // Hack - Remove passwords from configs
-          if ((cmd.getRole().equals(Role.HIVE_CLIENT.toString()) ||
-                  cmd.getRole().equals(Role.WEBHCAT_SERVER.toString()) ||
-                  cmd.getRole().equals(Role.HCAT.toString())) &&
-                  cmd.getConfigurations().containsKey(Configuration.HIVE_CONFIG_TAG)) {
-            cmd.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
-          }
+          ConfigHelper.processHiddenAttribute(cmd.getConfigurations(), cmd.getConfigurationAttributes(),
cmd.getRole(), false);
           processHostRole(stage, cmd, commandsToStart, commandsToUpdate);
         }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index d57b38f..b2a3761 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -833,10 +833,22 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       configs = new HashMap<String, Config>();
     }
 
-    // Configuration attributes are optional. If not present, use empty map
-    Map<String, Map<String, String>> propertiesAttributes = request.getPropertiesAttributes();
-    if (null == propertiesAttributes) {
-      propertiesAttributes = new HashMap<String, Map<String,String>>();
+    // Configuration attributes are optional. If not present, use default(provided by stack),
otherwise merge default
+    // with request-provided
+    Map<String, Map<String, String>> requestPropertiesAttributes = request.getPropertiesAttributes();
+
+    Map<String, Map<String, String>> propertiesAttributes = new HashMap<String,
Map<String,String>>();
+
+    StackId currentStackId = cluster.getCurrentStackVersion();
+    StackInfo currentStackInfo = ambariMetaInfo.getStack(currentStackId.getStackName(), currentStackId.getStackVersion());
+    Map<String, Map<String, String>> defaultConfigAttributes = currentStackInfo.getDefaultConfigAttributesForConfigType(configType);
+
+    if(defaultConfigAttributes != null){
+      ConfigHelper.mergeConfigAttributes(propertiesAttributes, defaultConfigAttributes);
+    }
+    // overwrite default attributes with request attributes
+    if(requestPropertiesAttributes != null){
+      ConfigHelper.mergeConfigAttributes(propertiesAttributes, requestPropertiesAttributes);
     }
 
     if (configs.containsKey(request.getVersionTag())) {
@@ -2867,13 +2879,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       }
     }
 
-    // Hack - Remove passwords from configs
-    if ((ec.getRole().equals(Role.HIVE_CLIENT.toString()) ||
-            ec.getRole().equals(Role.WEBHCAT_SERVER.toString()) ||
-            ec.getRole().equals(Role.HCAT.toString())) &&
-        ec.getConfigurations().containsKey(Configuration.HIVE_CONFIG_TAG)) {
-      ec.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
-    }
+    ConfigHelper.processHiddenAttribute(ec.getConfigurations(), ec.getConfigurationAttributes(),
ec.getRole(), false);
 
     // Add attributes
     Map<String, Map<String, Map<String, String>>> configAttributes =

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
index 9a86827..af24a69 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
@@ -264,9 +264,12 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
         }
       }
 
-      // Hack - Remove passwords from configs
-      if (configurations.get(Configuration.HIVE_CONFIG_TAG)!=null) {
-        configurations.get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
+      ConfigHelper.processHiddenAttribute(configurations, configurationAttributes, componentName,
true);
+
+      for(Map.Entry<String, Map<String, Map<String, String>>> configurationAttributesEntry
: configurationAttributes.entrySet()){
+        Map<String, Map<String, String>> attrs = configurationAttributesEntry.getValue();
+        // remove internal attributes like "hidden"
+        attrs.remove("hidden");
       }
 
       // replace passwords on password references

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 46a3f3e..ee9511f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -1322,6 +1322,57 @@ public class ConfigHelper {
   }
 
   /**
+   * Removes properties from configurations that marked as hidden for specified component.
+   * @param configurations cluster configurations
+   * @param attributes configuration attributes
+   * @param componentName component name
+   * @param configDownload indicates if config must be downloaded
+   */
+  public static void processHiddenAttribute(Map<String, Map<String, String>>
configurations,
+                                            Map<String, Map<String, Map<String,
String>>> attributes,
+                                            String componentName, boolean configDownload){
+    for(Map.Entry<String, Map<String,String>> confEntry : configurations.entrySet()){
+      String configTag = confEntry.getKey();
+      Map<String,String> confProperties = confEntry.getValue();
+      if(attributes.containsKey(configTag)){
+        Map<String, Map<String, String>> configAttributes = attributes.get(configTag);
+        if(configAttributes.containsKey("hidden")){
+          Map<String,String> hiddenProperties = configAttributes.get("hidden");
+          if(hiddenProperties != null) {
+            for (Map.Entry<String, String> hiddenEntry : hiddenProperties.entrySet())
{
+              String propertyName = hiddenEntry.getKey();
+              String components = hiddenEntry.getValue();
+              // hide property if we are downloading config & CONFIG_DOWNLOAD defined,
+              // otherwise - check if we have matching component name
+              if ((configDownload ? components.contains("CONFIG_DOWNLOAD") : components.contains(componentName))
+                  && confProperties.containsKey(propertyName)) {
+                confProperties.remove(propertyName);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Merge one attribute map to another.
+   * @param attributes original map
+   * @param additionalAttributes map with additional attributes
+   */
+  public static void mergeConfigAttributes(Map<String, Map<String, String>> attributes,
Map<String, Map<String, String>> additionalAttributes){
+    for(Map.Entry<String, Map<String, String>> attrEntry: additionalAttributes.entrySet()){
+      String attributeName = attrEntry.getKey();
+      Map<String, String> attributeProperties = attrEntry.getValue();
+      if(!attributes.containsKey(attributeName)) {
+        attributes.put(attributeName, attributeProperties);
+      } else {
+        attributes.get(attributeName).putAll(attributeProperties);
+      }
+    }
+  }
+
+  /**
    * Invalidates the {@link ConfigHelper#staleConfigsCache} after acquiring a
    * lock around {@link LockArea#STALE_CONFIG_CACHE}. It is necessary to acquire
    * this lock since the event which caused the config to become stale, such as

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
index c30f28f..14ff9de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
@@ -29,6 +29,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import com.google.common.io.Files;
 import org.apache.ambari.server.controller.StackVersionResponse;
 import org.apache.ambari.server.stack.Validable;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -60,6 +61,7 @@ public class StackInfo implements Comparable<StackInfo>, Validable{
   private boolean valid = true;
   private Map<String, Map<PropertyInfo.PropertyType, Set<String>>> propertiesTypesCache
=
       Collections.synchronizedMap(new HashMap<String, Map<PropertyInfo.PropertyType,
Set<String>>>());
+  private Map<String, Map<String, Map<String, String>>> configPropertyAttributes
=  null;
   /**
    * Meaning: stores subpath from stack root to exact hooks folder for stack. These hooks
are
    * applied to all commands for services in current stack.
@@ -485,6 +487,43 @@ public class StackInfo implements Comparable<StackInfo>, Validable{
   }
 
   /**
+   * Return default config attributes for specified config type.
+   * @param configType config type
+   * @return config attributes
+   */
+  public synchronized Map<String, Map<String, String>> getDefaultConfigAttributesForConfigType(String
configType){
+    if(configPropertyAttributes == null){
+      configPropertyAttributes = getDefaultConfigAttributes();
+    }
+    if(configPropertyAttributes.containsKey(configType)){
+      return configPropertyAttributes.get(configType);
+    }
+    return null;
+  }
+
+  private Map<String,  Map<String, Map<String, String>>> getDefaultConfigAttributes(){
+    Map<String,  Map<String, Map<String, String>>> result = new HashMap<>();
+    for(ServiceInfo si : services){
+      for(PropertyInfo pi : si.getProperties())
+      {
+        String propertyConfigType = Files.getNameWithoutExtension(pi.getFilename());
+        String propertyName = pi.getName();
+        String hidden = pi.getPropertyValueAttributes().getHidden();
+        if(hidden != null){
+          if(!result.containsKey(propertyConfigType)){
+            result.put(propertyConfigType, new HashMap<String, Map<String, String>>());
+          }
+          if(!result.get(propertyConfigType).containsKey("hidden")){
+            result.get(propertyConfigType).put("hidden", new HashMap<String, String>());
+          }
+          result.get(propertyConfigType).get("hidden").put(propertyName, hidden);
+        }
+      }
+    }
+    return result;
+  }
+
+  /**
    * @param key the version that the xml represents
    * @param xml the version definition object
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
index 7cccedf..5ece0ec 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
@@ -68,6 +68,9 @@ public class ValueAttributesInfo {
   @XmlElements(@XmlElement(name = "entry"))
   private Collection<ValueEntryInfo> entries;
 
+  @XmlElement(name = "hidden")
+  private String hidden;
+
   @XmlElement(name = "entries_editable")
   private Boolean entriesEditable;
 
@@ -127,6 +130,14 @@ public class ValueAttributesInfo {
     this.entries = entries;
   }
 
+  public String getHidden() {
+    return hidden;
+  }
+
+  public void setHidden(String hidden) {
+    this.hidden = hidden;
+  }
+
   public Boolean getEntriesEditable() {
     return entriesEditable;
   }
@@ -259,6 +270,8 @@ public class ValueAttributesInfo {
       return false;
     if (overridable != null ? !overridable.equals(that.overridable) : that.overridable !=
null)
       return false;
+    if (hidden != null ? !hidden.equals(that.overridable) : that.hidden != null)
+      return false;
     if (showPropertyName != null ? !showPropertyName.equals(that.showPropertyName) : that.showPropertyName
!= null)
       return false;
     if (uiOnlyProperty != null ? !uiOnlyProperty.equals(that.uiOnlyProperty) : that.uiOnlyProperty
!= null)
@@ -284,6 +297,7 @@ public class ValueAttributesInfo {
   @Override
   public int hashCode() {
     int result = type != null ? type.hashCode() : 0;
+    result = 31 * result + (hidden != null ? hidden.hashCode() : 0);
     result = 31 * result + (maximum != null ? maximum.hashCode() : 0);
     result = 31 * result + (minimum != null ? minimum.hashCode() : 0);
     result = 31 * result + (unit != null ? unit.hashCode() : 0);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
index 003b8ec..c53dd39 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
@@ -96,6 +96,7 @@ limitations under the License.
     <value-attributes>
       <type>password</type>
       <overridable>false</overridable>
+      <hidden>HIVE_CLIENT,WEBHCAT_SERVER,HCAT,CONFIG_DOWNLOAD</hidden>
     </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/resources/configuration-schema.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/configuration-schema.xsd b/ambari-server/src/main/resources/configuration-schema.xsd
index 0589d7e..41d4e51 100644
--- a/ambari-server/src/main/resources/configuration-schema.xsd
+++ b/ambari-server/src/main/resources/configuration-schema.xsd
@@ -94,6 +94,7 @@
           </xs:sequence>
         </xs:complexType>
       </xs:element>
+      <xs:element name="hidden" type="xs:string" minOccurs="0"/>
       <xs:element name="entries_editable" type="xs:boolean" minOccurs="0"/>
       <xs:element name="selection-cardinality" type="xs:string" minOccurs="0"/>
       <xs:element name="property-file-name" type="xs:string" minOccurs="0"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
index 229f7e1..1c8f475 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
@@ -79,6 +79,7 @@ limitations under the License.
     <value-attributes>
       <type>password</type>
       <overridable>false</overridable>
+      <hidden>HIVE_CLIENT,WEBHCAT_SERVER,HCAT,CONFIG_DOWNLOAD</hidden>
     </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
index 27d9e4b..bebc610 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
@@ -356,6 +356,7 @@ limitations under the License.
     <value-attributes>
       <type>password</type>
       <overridable>false</overridable>
+      <hidden>HIVE_CLIENT,WEBHCAT_SERVER,HCAT,CONFIG_DOWNLOAD</hidden>
     </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index 0ff143c..9d2fea5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -91,6 +91,7 @@ public class ConfigHelperTest {
     private ConfigGroupFactory configGroupFactory;
     private ConfigHelper configHelper;
     private AmbariManagementController managementController;
+    private AmbariMetaInfo metaInfo;
 
     @Before
     public void setup() throws Exception {
@@ -104,6 +105,7 @@ public class ConfigHelperTest {
       configGroupFactory = injector.getInstance(ConfigGroupFactory.class);
       configHelper = injector.getInstance(ConfigHelper.class);
       managementController = injector.getInstance(AmbariManagementController.class);
+      metaInfo = injector.getInstance(AmbariMetaInfo.class);
 
       clusterName = "c1";
       clusters.addCluster(clusterName, new StackId("HDP-2.0.6"));
@@ -261,6 +263,49 @@ public class ConfigHelperTest {
         add(clusterRequest);
       }}, null);
     }
+
+    @Test
+    public void testProcessHiddenAttribute()  throws Exception{
+      StackInfo stackInfo = metaInfo.getStack("HDP", "2.0.5");
+      Map<String, Map<String, Map<String, String>>> configAttributes =
new HashMap<String, Map<String, Map<String, String>>>();
+      configAttributes.put("hive-site", stackInfo.getDefaultConfigAttributesForConfigType("hive-site"));
+
+      Map<String, Map<String, String>> originalConfig_hiveClient = createHiveConfig();
+
+      Map<String, Map<String, String>> expectedConfig_hiveClient = new HashMap<String,
Map<String, String>>(){{
+        put("hive-site", new HashMap<String, String>(){{
+          put("javax.jdo.option.ConnectionDriverName", "oracle");
+          put("hive.metastore.warehouse.dir", "/tmp");
+        }});
+      }};
+
+      ConfigHelper.processHiddenAttribute(originalConfig_hiveClient, configAttributes, "HIVE_CLIENT",
false);
+      Assert.assertEquals(expectedConfig_hiveClient, originalConfig_hiveClient);
+
+      Map<String, Map<String, String>> originalConfig_hiveServer = createHiveConfig();
+      Map<String, Map<String, String>> expectedConfig_hiveServer = createHiveConfig();
+
+      ConfigHelper.processHiddenAttribute(originalConfig_hiveServer, configAttributes, "HIVE_SERVER",
false);
+      Assert.assertEquals(expectedConfig_hiveServer, originalConfig_hiveServer);
+
+      Map<String, Map<String, String>> originalConfig_hiveServer1 = createHiveConfig();
+      Map<String, Map<String, String>> expectedConfig_hiveServer1 = expectedConfig_hiveClient;
+
+      // config download removes hidden properties without respecting of component
+      ConfigHelper.processHiddenAttribute(originalConfig_hiveServer1, configAttributes, "HIVE_SERVER",
true);
+      Assert.assertEquals(expectedConfig_hiveServer1, originalConfig_hiveServer1);
+    }
+
+    private Map<String, Map<String, String>> createHiveConfig(){
+      return new HashMap<String, Map<String, String>>(){{
+        put("hive-site", new HashMap<String, String>(){{
+          put("javax.jdo.option.ConnectionDriverName", "oracle");
+          put("javax.jdo.option.ConnectionPassword", "1");
+          put("hive.metastore.warehouse.dir", "/tmp");
+        }});
+      }};
+    }
+
     @Test
     public void testEffectiveTagsForHost() throws Exception {
       final Config config = new ConfigImpl("core-site");

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7058684/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/configuration/hive-site.xml
index 5a3cb6c..8cfa26c 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.5/services/HIVE/configuration/hive-site.xml
@@ -46,6 +46,11 @@ limitations under the License.
     <name>javax.jdo.option.ConnectionPassword</name>
     <value/>
     <description>password to use against metastore database</description>
+    <value-attributes>
+      <type>password</type>
+      <overridable>false</overridable>
+      <hidden>HIVE_CLIENT,WEBHCAT_SERVER,HCAT,CONFIG_DOWNLOAD</hidden>
+    </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>
   <property>


Mime
View raw message