ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-12189. hive.security.authorization.enabled is not being handled properly during Ambari upgrade (smohanty)
Date Sun, 28 Jun 2015 18:49:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 63d074988 -> b71ad4bb6


AMBARI-12189. hive.security.authorization.enabled is not being handled properly during Ambari
upgrade (smohanty)


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

Branch: refs/heads/branch-2.1
Commit: b71ad4bb613fd18eb3c4c0706149b45010f3ae21
Parents: 63d0749
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Sun Jun 28 11:44:34 2015 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Sun Jun 28 11:49:17 2015 -0700

----------------------------------------------------------------------
 .../apache/ambari/server/upgrade/UpgradeCatalog210.java |  3 +++
 .../ambari/server/upgrade/UpgradeCatalog210Test.java    | 12 ++++++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b71ad4bb/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index c485e02..cb05c83 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -1213,17 +1213,20 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
                   && RangerHiveConfig.getProperties().containsKey("ranger-hive-plugin-enabled")
                   && cluster.getDesiredConfigByType("hive-env") != null) {
             Map<String, String> newHiveEnvProperties = new HashMap<String, String>();
+            Map<String, String> newHiveServerProperties = new HashMap<String, String>();
             Set<String> removeRangerHiveProperties = new HashSet<String>();
             removeRangerHiveProperties.add("ranger-hive-plugin-enabled");
 
             if (RangerHiveConfig.getProperties().get("ranger-hive-plugin-enabled") != null
                     && RangerHiveConfig.getProperties().get("ranger-hive-plugin-enabled").equalsIgnoreCase("yes"))
{
               newHiveEnvProperties.put("hive_security_authorization", "Ranger");
+              newHiveServerProperties.put("hive.security.authorization.enabled", "true");
             } else {
               newHiveEnvProperties.put("hive_security_authorization", "None");
             }
             boolean updateProperty = cluster.getDesiredConfigByType("hive-env").getProperties().containsKey("hive_security_authorization");
             updateConfigurationPropertiesForCluster(cluster, "hive-env", newHiveEnvProperties,
updateProperty, true);
+            updateConfigurationPropertiesForCluster(cluster, "hiveserver2-site", newHiveServerProperties,
updateProperty, true);
             updateConfigurationPropertiesForCluster(cluster, "ranger-hive-plugin-properties",
new HashMap<String, String>(),
                     removeRangerHiveProperties, false, true);
           }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b71ad4bb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
index 495f302..ea812ab 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
@@ -37,6 +37,7 @@ import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -49,6 +50,7 @@ import com.google.inject.AbstractModule;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
@@ -236,10 +238,12 @@ public class UpgradeCatalog210Test {
 
     final Config mockRangerPlugin = easyMockSupport.createNiceMock(Config.class);
     final Config mockHiveEnv = easyMockSupport.createNiceMock(Config.class);
+    final Config mockHiveServer = easyMockSupport.createNiceMock(Config.class);
 
     final Map<String, String> propertiesExpectedRangerPlugin = new HashMap<String,
String>();
     propertiesExpectedRangerPlugin.put("ranger-hive-plugin-enabled", "yes");
     final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>();
+    final Map<String, String> propertiesExpectedHiveServer2 = new HashMap<String,
String>();
     final Injector mockInjector = Guice.createInjector(new AbstractModule() {
       @Override
       protected void configure() {
@@ -259,8 +263,16 @@ public class UpgradeCatalog210Test {
 
     expect(mockClusterExpected.getDesiredConfigByType("ranger-hive-plugin-properties")).andReturn(mockRangerPlugin).atLeastOnce();
     expect(mockClusterExpected.getDesiredConfigByType("hive-env")).andReturn(mockHiveEnv).atLeastOnce();
+    expect(mockClusterExpected.getDesiredConfigByType("hiveserver2-site")).andReturn(mockHiveServer).atLeastOnce();
     expect(mockRangerPlugin.getProperties()).andReturn(propertiesExpectedRangerPlugin).anyTimes();
     expect(mockHiveEnv.getProperties()).andReturn(propertiesExpectedHiveEnv).anyTimes();
+    expect(mockHiveServer.getProperties()).andReturn(propertiesExpectedHiveServer2).anyTimes();
+
+    ServiceConfigVersionResponse r = null;
+    expect(mockClusterExpected.getConfig(anyObject(String.class), anyObject(String.class))).
+        andReturn(mockHiveServer).anyTimes();
+    expect(mockClusterExpected.addDesiredConfig("ambari-upgrade", Collections.singleton(mockHiveServer))).
+        andReturn(r).times(3);
 
     easyMockSupport.replayAll();
     mockInjector.getInstance(UpgradeCatalog210.class).updateRangerHiveConfigs();


Mime
View raw message