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 2016/09/09 13:57:45 UTC

ambari git commit: AMBARI-18340. Kafka acls setup is failing as part of atlas start

Repository: ambari
Updated Branches:
  refs/heads/trunk 172197d28 -> 137d08e86


AMBARI-18340. Kafka acls setup is failing as part of atlas start


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

Branch: refs/heads/trunk
Commit: 137d08e866b2ae9cbc6d4d936a9798fe063e69fd
Parents: 172197d
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri Sep 9 06:57:37 2016 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri Sep 9 06:57:37 2016 -0700

----------------------------------------------------------------------
 .../ATLAS/0.1.0.2.3/package/scripts/metadata.py | 27 ++++++++++----------
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |  1 +
 .../package/templates/atlas_kafka_acl.sh.j2     | 17 +++++++++++-
 3 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/137d08e8/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
index b16f597..0c07018 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
@@ -130,25 +130,26 @@ def metadata(type='server'):
          content=Template("atlas_hbase_setup.rb.j2")
     )
 
-    if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, get_stack_feature_version(params.config)) and\
-      params.security_enabled and not params.host_with_kafka:
+    is_atlas_upgrade_support = check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, get_stack_feature_version(params.config))
+
+    if is_atlas_upgrade_support and params.security_enabled:
 
       File(params.atlas_kafka_setup,
            group=params.user_group,
            owner=params.kafka_user,
-           content=Template("atlas_kafka_acl.sh.j2")
-      )
+           content=Template("atlas_kafka_acl.sh.j2"))
 
-      File(format("{kafka_conf_dir}/kafka-env.sh"),
-           owner=params.kafka_user,
-           content=InlineTemplate(params.kafka_env_sh_template)
-           )
+      #  files required only in case if kafka broker is not present on the host as configured component
+      if not params.host_with_kafka:
+        File(format("{kafka_conf_dir}/kafka-env.sh"),
+             owner=params.kafka_user,
+             content=InlineTemplate(params.kafka_env_sh_template))
+
+        File(format("{kafka_conf_dir}/kafka_jaas.conf"),
+             group=params.user_group,
+             owner=params.kafka_user,
+             content=Template("kafka_jaas.conf.j2"))
 
-      File(format("{kafka_conf_dir}/kafka_jaas.conf"),
-           group=params.user_group,
-           owner=params.kafka_user,
-           content=Template("kafka_jaas.conf.j2")
-           )
 
 def upload_conf_set(config_set, jaasFile):
   import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/137d08e8/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index 464de02..9f8180e 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -255,6 +255,7 @@ ranger_user = default('/configurations/ranger-env/ranger_user', None)
 
 kafka_keytab = default('/configurations/kafka-env/kafka_keytab', None)
 kafka_principal_name = default('/configurations/kafka-env/kafka_principal_name', None)
+default_replication_factor = default('/configurations/application-properties/atlas.notification.replicas', None)
 
 if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, version_for_stack_feature_checks):
   default_replication_factor = default('/configurations/application-properties/atlas.notification.replicas', None)

http://git-wip-us.apache.org/repos/asf/ambari/blob/137d08e8/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/templates/atlas_kafka_acl.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/templates/atlas_kafka_acl.sh.j2 b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/templates/atlas_kafka_acl.sh.j2
index 34171bf..ca7a85d 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/templates/atlas_kafka_acl.sh.j2
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/templates/atlas_kafka_acl.sh.j2
@@ -15,7 +15,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #}
-#!/usr/bin/bash
+#!/bin/bash
+
+
+create_topic() {
+    topic_name=$1
+    topics=`{{kafka_home}}/bin/kafka-topics.sh --zookeeper {{kafka_zk_endpoint}} --topic $topic_name --list`
+    if [ -z $topics ]; then
+      {{kafka_home}}/bin/kafka-topics.sh --zookeeper {{kafka_zk_endpoint}} --topic $topic_name --create --partitions 1 --replication-factor {{default_replication_factor}}
+      echo "Created topic $topic_name with replication factor {{default_replication_factor}}"
+    else
+      echo "Topic $topic_name already exists"
+    fi
+}
+
+create_topic ATLAS_HOOK
+create_topic ATLAS_ENTITIES
 
 {{kafka_home}}/bin/kafka-acls.sh --authorizer-properties zookeeper.connect={{kafka_zk_endpoint}} --add  --topic ATLAS_HOOK --allow-principal User:* --producer
 {{kafka_home}}/bin/kafka-acls.sh --authorizer-properties zookeeper.connect={{kafka_zk_endpoint}} --add  --topic ATLAS_HOOK --allow-principal User:{{metadata_user}} --consumer --group atlas