You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/09/16 16:32:58 UTC
ambari git commit: AMBARI-13112 getting consistency check failed
error while adding new service (dsen)
Repository: ambari
Updated Branches:
refs/heads/trunk 2fce6d258 -> a249e30f2
AMBARI-13112 getting consistency check failed error while adding new service (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a249e30f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a249e30f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a249e30f
Branch: refs/heads/trunk
Commit: a249e30f2435f6a985c0b04a10bd364533ada33a
Parents: 2fce6d2
Author: Dmytro Sen <ds...@apache.org>
Authored: Wed Sep 16 17:32:33 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Wed Sep 16 17:32:33 2015 +0300
----------------------------------------------------------------------
.../stacks/HDP/2.2/services/stack_advisor.py | 12 ++++--
.../stacks/2.2/common/test_stack_advisor.py | 41 ++++++++++++++++++++
2 files changed, 50 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a249e30f/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 3f15c5f..8bf0b32 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -375,7 +375,13 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
putHiveSiteProperty("hive.server2.tez.default.queues", ",".join([leafQueue['value'] for leafQueue in leafQueues]))
# Security
- putHiveEnvProperty("hive_security_authorization", "None")
+ if ("configurations" not in services) or ("hive-env" not in services["configurations"]) or \
+ ("properties" not in services["configurations"]["hive-env"]) or \
+ ("hive_security_authorization" not in services["configurations"]["hive-env"]["properties"]) or \
+ str(services["configurations"]["hive-env"]["properties"]["hive_security_authorization"]).lower() == "none":
+ putHiveEnvProperty("hive_security_authorization", "None")
+ else:
+ putHiveEnvProperty("hive_security_authorization", services["configurations"]["hive-env"]["properties"]["hive_security_authorization"])
# hive_security_authorization == 'none'
# this property is unrelated to Kerberos
if str(configurations["hive-env"]["properties"]["hive_security_authorization"]).lower() == "none":
@@ -952,14 +958,14 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
if ranger_plugin_enabled:
prop_name = 'hive.security.authorization.manager'
prop_val = "com.xasecure.authorization.hive.authorizer.XaSecureHiveAuthorizerFactory"
- if hive_server2[prop_name] != prop_val:
+ if prop_name not in hive_server2 or hive_server2[prop_name] != prop_val:
validationItems.append({"config-name": prop_name,
"item": self.getWarnItem(
"If Ranger Hive Plugin is enabled."\
" {0} needs to be set to {1}".format(prop_name,prop_val))})
prop_name = 'hive.security.authenticator.manager'
prop_val = "org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator"
- if hive_server2[prop_name] != prop_val:
+ if prop_name not in hive_server2 or hive_server2[prop_name] != prop_val:
validationItems.append({"config-name": prop_name,
"item": self.getWarnItem(
"If Ranger Hive Plugin is enabled."\
http://git-wip-us.apache.org/repos/asf/ambari/blob/a249e30f/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index c5abb95..4c29dd8 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -1373,6 +1373,15 @@ class TestHDP22StackAdvisor(TestCase):
self.assertEquals(configurations["hive-env"]["property_attributes"]["hive.metastore.heapsize"]["maximum"], "1877")
self.assertEquals(configurations["hive-env"]["property_attributes"]["hive.client.heapsize"]["maximum"], "1877")
+ # test 'hive_security_authorization'=='ranger'
+ services["configurations"]["hive-env"]["properties"]["hive_security_authorization"] = "ranger"
+ expected["hiveserver2-site"]["properties"]["hive.security.authenticator.manager"] = "org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator"
+ expected["hiveserver2-site"]["properties"]["hive.security.authorization.manager"] = "com.xasecure.authorization.hive.authorizer.XaSecureHiveAuthorizerFactory"
+ expected["hiveserver2-site"]["properties"]["hive.security.authorization.enabled"] = "true"
+ self.stackAdvisor.recommendHIVEConfigurations(configurations, clusterData, services, hosts)
+ self.assertEquals(configurations['hiveserver2-site'], expected["hiveserver2-site"])
+
+
def test_recommendMapredConfigurationAttributesWithPigService(self):
configurations = {
"mapred-site": {
@@ -2859,6 +2868,38 @@ class TestHDP22StackAdvisor(TestCase):
pass
+ def test_validateHiveServer2Configurations(self):
+ properties = {"hive_security_authorization": "None",
+ "hive.exec.orc.default.stripe.size": "8388608",
+ 'hive.tez.container.size': '2048',
+ 'hive.tez.java.opts': '-Xmx300m',
+ 'hive.auto.convert.join.noconditionaltask.size': '1100000000'}
+ recommendedDefaults = {'hive.tez.container.size': '1024',
+ 'hive.tez.java.opts': '-Xmx256m',
+ 'hive.auto.convert.join.noconditionaltask.size': '1000000000'}
+ configurations = {
+ "hive-site": {
+ "properties": {"hive.security.authorization.enabled": "true"}
+ },
+ "hive-env": {
+ "properties": {"hive_security_authorization": "ranger"}
+ }
+ }
+ services = {
+ "services": [
+ {
+ "StackServices": {
+ "service_name": "RANGER",
+ },
+ }
+ ],
+ }
+
+ # Test with ranger plugin enabled, validation fails
+ res_expected = [{'config-type': 'hiveserver2-site', 'message': 'If Ranger Hive Plugin is enabled. hive.security.authorization.manager needs to be set to com.xasecure.authorization.hive.authorizer.XaSecureHiveAuthorizerFactory', 'type': 'configuration', 'config-name': 'hive.security.authorization.manager', 'level': 'WARN'}, {'config-type': 'hiveserver2-site', 'message': 'If Ranger Hive Plugin is enabled. hive.security.authenticator.manager needs to be set to org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator', 'type': 'configuration', 'config-name': 'hive.security.authenticator.manager', 'level': 'WARN'}]
+ res = self.stackAdvisor.validateHiveServer2Configurations(properties, recommendedDefaults, configurations, services, {})
+ self.assertEquals(res, res_expected)
+
def test_recommendYarnCGroupConfigurations(self):
servicesList = ["YARN"]
configurations = {}