You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2015/06/28 20:48:47 UTC
ambari git commit: AMBARI-12189. hive.security.authorization.enabled
is not being handled properly during Ambari upgrade (smohanty)
Repository: ambari
Updated Branches:
refs/heads/trunk 955cfce2c -> cebcfdee0
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/cebcfdee
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cebcfdee
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cebcfdee
Branch: refs/heads/trunk
Commit: cebcfdee0a9b8599d9d82a45246b658ceffa3c68
Parents: 955cfce
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Jun 28 11:44:34 2015 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Jun 28 11:44:34 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/cebcfdee/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/cebcfdee/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();