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/10/26 17:28:07 UTC
ambari git commit: AMBARI-13545 Invalidate enabling Storm ranger
plugin in non kerberos environment (dsen)
Repository: ambari
Updated Branches:
refs/heads/trunk 395ff0941 -> 88bb0a73d
AMBARI-13545 Invalidate enabling Storm ranger plugin in non kerberos environment (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/88bb0a73
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/88bb0a73
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/88bb0a73
Branch: refs/heads/trunk
Commit: 88bb0a73d3e782b0ccd1fe2d09885bcc383e39f8
Parents: 395ff09
Author: Dmytro Sen <ds...@apache.org>
Authored: Mon Oct 26 18:27:51 2015 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Mon Oct 26 18:27:51 2015 +0200
----------------------------------------------------------------------
.../stacks/HDP/2.2/services/stack_advisor.py | 25 ++++++++-
.../stacks/2.2/common/test_stack_advisor.py | 55 ++++++++++++++++++++
.../stacks/2.3/common/test_stack_advisor.py | 4 +-
3 files changed, 81 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/88bb0a73/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 707a641..2a2944c 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
@@ -38,7 +38,8 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
"AMBARI_METRICS": self.recommendAmsConfigurations,
"YARN": self.recommendYARNConfigurations,
"STORM": self.recommendStormConfigurations,
- "KNOX": self.recommendKnoxConfigurations
+ "KNOX": self.recommendKnoxConfigurations,
+ "RANGER": self.recommendRangerConfigurations
}
parentRecommendConfDict.update(childRecommendConfDict)
return parentRecommendConfDict
@@ -829,6 +830,15 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
putKnoxTopologyContent('content', newTopologyXmlContent)
+ def recommendRangerConfigurations(self, configurations, clusterData, services, hosts):
+ super(HDP22StackAdvisor, self).recommendRangerConfigurations(configurations, clusterData, services, hosts)
+ putRangerEnvProperty = self.putProperty(configurations, "ranger-env")
+ cluster_env = getServicesSiteProperties(services, "cluster-env")
+ security_enabled = cluster_env is not None and "security_enabled" in cluster_env and \
+ cluster_env["security_enabled"].lower() == "true"
+ if "ranger-env" in configurations and not security_enabled:
+ putRangerEnvProperty("ranger-storm-plugin-enabled", "No")
+
def getServiceConfigurationValidators(self):
parentValidators = super(HDP22StackAdvisor, self).getServiceConfigurationValidators()
childValidators = {
@@ -847,7 +857,8 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
"KAFKA": {"ranger-kafka-plugin-properties": self.validateKafkaRangerPluginConfigurations},
"STORM": {"ranger-storm-plugin-properties": self.validateStormRangerPluginConfigurations},
"MAPREDUCE2": {"mapred-site": self.validateMapReduce2Configurations},
- "TEZ": {"tez-site": self.validateTezConfigurations}
+ "TEZ": {"tez-site": self.validateTezConfigurations},
+ "RANGER": {"ranger-env": self.validateRangerConfigurationsEnv}
}
self.mergeValidators(parentValidators, childValidators)
return parentValidators
@@ -1379,6 +1390,16 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
"ranger-yarn-plugin-properties/ranger-yarn-plugin-enabled must correspond ranger-env/ranger-yarn-plugin-enabled")})
return self.toConfigurationValidationProblems(validationItems, "ranger-yarn-plugin-properties")
+ def validateRangerConfigurationsEnv(self, properties, recommendedDefaults, configurations, services, hosts):
+ validationItems = []
+ if "ranger-storm-plugin-enabled" in properties and "ranger-storm-plugin-enabled" in recommendedDefaults and \
+ properties["ranger-storm-plugin-enabled"] != recommendedDefaults["ranger-storm-plugin-enabled"]:
+ validationItems.append({"config-name": "ranger-storm-plugin-enabled",
+ "item": self.getWarnItem(
+ "Ranger Storm plugin should not be enabled in non-kerberos environment.")})
+
+ return self.toConfigurationValidationProblems(validationItems, "ranger-env")
+
def getMastersWithMultipleInstances(self):
result = super(HDP22StackAdvisor, self).getMastersWithMultipleInstances()
result.extend(['METRICS_COLLECTOR'])
http://git-wip-us.apache.org/repos/asf/ambari/blob/88bb0a73/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 7abdcd0..a877370 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
@@ -3494,3 +3494,58 @@ class TestHDP22StackAdvisor(TestCase):
res = self.stackAdvisor.validateStormRangerPluginConfigurations(properties, recommendedDefaults, configurations, services, {})
self.assertEquals(res, res_expected)
+
+ def test_recommendRangerConfigurations(self):
+ clusterData = {}
+ # Recommend ranger-storm-plugin-enabled=No on non-kerberos cluster
+ services = {
+ "Versions" : {
+ "stack_version" : "2.3",
+ },
+ "services": [
+ {
+ "StackServices": {
+ "service_name": "RANGER"
+ },
+ "components": [
+ {
+ "StackServiceComponents": {
+ "component_name": "RANGER_ADMIN",
+ "hostnames": ["host1"]
+ }
+ }
+ ]
+ },
+ ],
+ "configurations": {
+ "cluster-env": {
+ "properties": {
+ "security_enabled": "false",
+ }
+ },
+ },
+ }
+
+ expected = {
+ 'admin-properties': {'properties': {'policymgr_external_url': 'http://host1:6080'}}, 'ranger-env': {'properties': {'ranger-storm-plugin-enabled': 'No'}}
+ }
+
+ recommendedConfigurations = {}
+ self.stackAdvisor.recommendRangerConfigurations(recommendedConfigurations, clusterData, services, None)
+ self.assertEquals(recommendedConfigurations, expected)
+
+ def test_validateRangerConfigurationsEnv(self):
+ properties = {
+ "ranger-storm-plugin-enabled": "Yes",
+ }
+ recommendedDefaults = {
+ "ranger-storm-plugin-enabled": "No",
+ }
+ configurations = {}
+ services = {}
+
+ # Test with ranger plugin enabled, validation fails
+ res_expected = [{'config-type': 'ranger-env', 'message': 'Ranger Storm plugin should not be enabled in non-kerberos environment.', 'type': 'configuration', 'config-name': 'ranger-storm-plugin-enabled', 'level': 'WARN'}]
+ res = self.stackAdvisor.validateRangerConfigurationsEnv(properties, recommendedDefaults, configurations, services, {})
+ self.assertEquals(res, res_expected)
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/88bb0a73/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 33ad293..b886117 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -1095,7 +1095,9 @@ class TestHDP23StackAdvisor(TestCase):
}
},
'ranger-env': {
- 'properties': {}
+ 'properties': {
+ 'ranger-storm-plugin-enabled': 'No',
+ }
}
}