ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-17223. Ability to add "javax.jdo.option.ConnectionPassword" to hive clients from ambari.(vbrodetskyi)
Date Thu, 16 Jun 2016 14:10:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1f71ea63a -> 6bdc2b247


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


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

Branch: refs/heads/trunk
Commit: 6bdc2b2476e46ee447fbdc360f8f873ab7a17973
Parents: 1f71ea6
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Thu Jun 16 00:04:09 2016 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Thu Jun 16 00:04:09 2016 +0300

----------------------------------------------------------------------
 .../ambari/server/actionmanager/ActionScheduler.java     | 11 +++++++++--
 .../ambari/server/configuration/Configuration.java       |  2 ++
 .../controller/AmbariManagementControllerImpl.java       | 10 +++++++++-
 .../internal/ClientConfigResourceProvider.java           |  9 ++++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6bdc2b24/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 33c0a1f..4078500 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
@@ -328,12 +328,19 @@ class ActionScheduler implements Runnable {
         //Schedule what we have so far
 
         for (ExecutionCommand cmd : commandsToSchedule) {
-
+          boolean hidePassword = true;
+          Map<String, Map<String, String>> configurations = cmd.getConfigurations();
+          if(configurations != null && configurations.containsKey(Configuration.HIVE_ENV_CONFIG_TAG)){
+            if(configurations.get(Configuration.HIVE_ENV_CONFIG_TAG).containsKey(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY))
{
+              String hidePasswordStr = configurations.get(Configuration.HIVE_ENV_CONFIG_TAG).get(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY);
+              hidePassword = Boolean.parseBoolean(hidePasswordStr);
+            }
+          }
           // 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().containsKey(Configuration.HIVE_CONFIG_TAG) &&
hidePassword) {
             cmd.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
           }
           processHostRole(stage, cmd, commandsToStart, commandsToUpdate);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6bdc2b24/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 2b7fca0..29b678e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -365,7 +365,9 @@ public class Configuration {
   public static final String MAPREDUCE2_LOG4J_CONFIG_TAG = "mapreduce2-log4j";
   public static final String RCA_ENABLED_PROPERTY = "rca_enabled";
   public static final String HIVE_CONFIG_TAG = "hive-site";
+  public static final String HIVE_ENV_CONFIG_TAG = "hive-env";
   public static final String HIVE_METASTORE_PASSWORD_PROPERTY = "javax.jdo.option.ConnectionPassword";
+  public static final String HIVE_ENV_HIDE_PASSWORD_PROPERTY = "javax.jdo.option.ConnectionPassword.hide";
   public static final String MASTER_KEY_PERSISTED = "security.master.key.ispersisted";
   public static final String MASTER_KEY_LOCATION = "security.master.key.location";
   public static final String MASTER_KEYSTORE_LOCATION = "security.master.keystore.location";

http://git-wip-us.apache.org/repos/asf/ambari/blob/6bdc2b24/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 b5c6fc2..68a315c 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
@@ -2806,10 +2806,18 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     }
 
     // Hack - Remove passwords from configs
+    boolean hidePassword = true;
+    Map<String, Map<String, String>> configs = ec.getConfigurations();
+    if(configs.containsKey(Configuration.HIVE_ENV_CONFIG_TAG)){
+      if(configs.get(Configuration.HIVE_ENV_CONFIG_TAG).containsKey(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY))
{
+        String hidePasswordStr = configs.get(Configuration.HIVE_ENV_CONFIG_TAG).get(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY);
+        hidePassword = Boolean.parseBoolean(hidePasswordStr);
+      }
+    }
     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().containsKey(Configuration.HIVE_CONFIG_TAG) && hidePassword)
{
       ec.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6bdc2b24/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..700e81f 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
@@ -265,7 +265,14 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
       }
 
       // Hack - Remove passwords from configs
-      if (configurations.get(Configuration.HIVE_CONFIG_TAG)!=null) {
+      boolean hidePassword = true;
+      if(configurations.containsKey(Configuration.HIVE_ENV_CONFIG_TAG)){
+        if(configurations.get(Configuration.HIVE_ENV_CONFIG_TAG).containsKey(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY))
{
+          String hidePasswordStr = configurations.get(Configuration.HIVE_ENV_CONFIG_TAG).get(Configuration.HIVE_ENV_HIDE_PASSWORD_PROPERTY);
+          hidePassword = Boolean.parseBoolean(hidePasswordStr);
+        }
+      }
+      if (configurations.get(Configuration.HIVE_CONFIG_TAG)!=null && hidePassword)
{
         configurations.get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
       }
 


Mime
View raw message