ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [07/16] ambari git commit: AMBARI-21560 Auto populate zookeeper.connect in Ranger Kafka plugin properties (mugdha)
Date Mon, 31 Jul 2017 14:01:31 GMT
AMBARI-21560 Auto populate zookeeper.connect in Ranger Kafka plugin properties (mugdha)


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

Branch: refs/heads/branch-2.6
Commit: 9d80540f61f9cee11467755ec5aa6cc2ce8db6c7
Parents: 0fa6e20
Author: Mugdha Varadkar <mugdha@apache.org>
Authored: Mon Jul 24 16:17:34 2017 +0530
Committer: Mugdha Varadkar <mugdha@apache.org>
Committed: Fri Jul 28 12:59:59 2017 +0530

----------------------------------------------------------------------
 .../ranger-kafka-plugin-properties.xml          |  6 ++++++
 .../stacks/HDP/2.3/services/stack_advisor.py    |  5 +++++
 .../stacks/2.3/common/test_stack_advisor.py     | 22 ++++++++++++++++++--
 3 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9d80540f/ambari-server/src/main/resources/common-services/KAFKA/0.9.0/configuration/ranger-kafka-plugin-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.9.0/configuration/ranger-kafka-plugin-properties.xml
b/ambari-server/src/main/resources/common-services/KAFKA/0.9.0/configuration/ranger-kafka-plugin-properties.xml
index 3949402..1250f17 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.9.0/configuration/ranger-kafka-plugin-properties.xml
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.9.0/configuration/ranger-kafka-plugin-properties.xml
@@ -48,6 +48,12 @@
     <name>zookeeper.connect</name>
     <value>localhost:2181</value>
     <description>Used for repository creation on ranger admin</description>
+    <depends-on>
+      <property>
+        <type>zoo.cfg</type>
+        <name>clientPort</name>
+      </property>
+    </depends-on>
     <on-ambari-upgrade add="false"/>
   </property>
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9d80540f/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index d0f82af..e660742 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -446,6 +446,11 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
             kafkaLog4jContent+= '\n' + kafkaLog4jRangerLines[item]["name"] + '=' + kafkaLog4jRangerLines[item]["value"]
         putKafkaLog4jProperty("content",kafkaLog4jContent)
 
+      zookeeper_host_port = self.getZKHostPortString(services)
+      if zookeeper_host_port:
+        putRangerKafkaPluginProperty = self.putProperty(configurations, 'ranger-kafka-plugin-properties',
services)
+        putRangerKafkaPluginProperty('zookeeper.connect', zookeeper_host_port)
+
   def recommendRangerKMSConfigurations(self, configurations, clusterData, services, hosts):
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
     putRangerKmsDbksProperty = self.putProperty(configurations, "dbks-site", services)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9d80540f/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 fe3d26d..ff57c7b 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
@@ -298,6 +298,17 @@ class TestHDP23StackAdvisor(TestCase):
               }
 
             }]
+          },
+          {
+            "StackServices": {
+              "service_name": "ZOOKEEPER"
+            },
+            "components": [{
+              "StackServiceComponents": {
+                "component_name": "ZOOKEEPER_SERVER",
+                "hostnames": ["host1"]
+              }
+            }]
           }
         ],
       "Versions": {
@@ -305,7 +316,7 @@ class TestHDP23StackAdvisor(TestCase):
       },
       "configurations": {
         "core-site": {
-          "properties": { },
+          "properties": {}
         },
         "cluster-env": {
           "properties": {
@@ -321,13 +332,19 @@ class TestHDP23StackAdvisor(TestCase):
         },
         "ranger-kafka-plugin-properties": {
           "properties": {
-            "ranger-kafka-plugin-enabled": "No"
+            "ranger-kafka-plugin-enabled": "No",
+            "zookeeper.connect": ""
           }
         },
         "kafka-log4j": {
           "properties": {
             "content": "kafka.logs.dir=logs"
           }
+        },
+        "zoo.cfg" : {
+          "properties": {
+            "clientPort": "2181"
+          }
         }
       }
     }
@@ -364,6 +381,7 @@ class TestHDP23StackAdvisor(TestCase):
     services['configurations']['ranger-kafka-plugin-properties']['properties']['ranger-kafka-plugin-enabled']
= 'Yes'
     self.stackAdvisor.recommendKAFKAConfigurations(configurations, clusterData, services,
None)
     self.assertEquals(configurations['kafka-broker']['properties']['authorizer.class.name'],
'org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer', "Test authorizer.class.name
with Ranger Kafka plugin enabled in kerberos environment")
+    self.assertEquals(configurations['ranger-kafka-plugin-properties']['properties']['zookeeper.connect'],
'host1:2181')
 
     # Test kafka-log4j content when Ranger plugin for Kafka is enabled
 


Mime
View raw message