ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-11580. Apply Now popup for Ranger Kafka Plugin. (akovalenko)
Date Sun, 31 May 2015 22:00:48 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3ac16966d -> 5204b3a02


AMBARI-11580. Apply Now popup for Ranger Kafka Plugin. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 5204b3a02d48720eb61ea3465aa9f7adb893c6e3
Parents: 3ac1696
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Mon Jun 1 00:55:27 2015 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Mon Jun 1 01:00:27 2015 +0300

----------------------------------------------------------------------
 .../KAFKA/0.8.1.2.2/configuration/kafka-env.xml |  3 +
 .../KAFKA/configuration/kafka-broker.xml        |  5 ++
 .../configs/modification_handlers/kafka.js      | 71 ++++++++++++++++++++
 3 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5204b3a0/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
index 362d316..2fed180 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
@@ -58,6 +58,9 @@ if [ -e "/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar"
]; th
   export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar
   export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*
 fi
+if [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then
+./etc/kafka/conf/kafka-ranger-env.sh
+fi
     </value>
   </property>
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5204b3a0/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/configuration/kafka-broker.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/configuration/kafka-broker.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/configuration/kafka-broker.xml
index e621ddf..db0748a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/configuration/kafka-broker.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/KAFKA/configuration/kafka-broker.xml
@@ -124,4 +124,9 @@
     <description>Deprecated config in favor of listeners config.</description>
     <deleted>true</deleted>
   </property>
+  <property>
+    <name>authorizer.class.name</name>
+    <description></description>
+    <value>kafka.security.auth.SimpleAclAuthorizer</value>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5204b3a0/ambari-web/app/utils/configs/modification_handlers/kafka.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/modification_handlers/kafka.js b/ambari-web/app/utils/configs/modification_handlers/kafka.js
new file mode 100644
index 0000000..ff5168f
--- /dev/null
+++ b/ambari-web/app/utils/configs/modification_handlers/kafka.js
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+require('utils/configs/modification_handlers/modification_handler');
+
+module.exports = App.ServiceConfigModificationHandler.create({
+  serviceId: 'KAFKA',
+
+  getDependentConfigChanges: function (changedConfig, selectedServices, allConfigs) {
+    var rangerPluginEnabledName = "ranger-kafka-plugin-enabled";
+    var affectedProperties = [];
+    var affectedPropertyName = changedConfig.get("name");
+    var authorizerClassName, kafkaLog4jContent, newLog4jContentValue;
+    var isEnabling = changedConfig.get('value') === 'Yes';
+
+    if (affectedPropertyName === rangerPluginEnabledName) {
+      authorizerClassName = this.getConfig(allConfigs, 'authorizer.class.name', 'kafka-broker.xml',
'KAFKA');
+      kafkaLog4jContent = this.getConfig(allConfigs, 'content', 'kafka-log4j.xml', 'KAFKA');
+      newLog4jContentValue = kafkaLog4jContent.get('value');
+      newLog4jContentValue += "\n\nlog4j.appender.rangerAppender=org.apache.log4j.DailyRollingFileAppender\n"
+
+      "log4j.appender.rangerAppender.DatePattern='.'yyyy-MM-dd-HH\n" +
+      "log4j.appender.rangerAppender.File=${kafka.logs.dir}/ranger_kafka.log\n" +
+      "log4j.appender.rangerAppender.layout=org.apache.log4j.PatternLayout\n" +
+      "log4j.appender.rangerAppender.layout.ConversionPattern=%d{ISO8601} %p [%t] %C{6} (%F:%L)
- %m%n\n" +
+      "log4j.logger.org.apache.ranger=INFO, rangerAppender";
+
+      affectedProperties = [
+        {
+          serviceName: "KAFKA",
+          sourceServiceName: "KAFKA",
+          propertyName: 'authorizer.class.name',
+          propertyDisplayName: 'authorizer.class.name',
+          newValue: isEnabling ? 'org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer'
:
+              App.StackConfigProperty.find().findProperty('name', 'authorizer.class.name').get('value'),
+          curValue: authorizerClassName.get('value'),
+          changedPropertyName: rangerPluginEnabledName,
+          removed: false,
+          filename: 'kafka-broker.xml'
+        },
+        {
+          serviceName: "KAFKA",
+          sourceServiceName: "KAFKA",
+          propertyName: 'content',
+          propertyDisplayName: 'content',
+          newValue: isEnabling ? newLog4jContentValue : App.StackConfigProperty.find().filterProperty('filename',
'kafka-log4j.xml').findProperty('name', 'content').get('value'),
+          curValue: kafkaLog4jContent.get('value'),
+          changedPropertyName: rangerPluginEnabledName,
+          removed: false,
+          filename: 'kafka-log4j.xml'
+        }
+      ];
+    }
+
+    return affectedProperties;
+  }
+});


Mime
View raw message