ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-18340. Kafka acls setup is failing as part of atlas start
Date Fri, 09 Sep 2016 14:01:17 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 339311034 -> d4d182859


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/d4d18285
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d4d18285
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d4d18285

Branch: refs/heads/branch-2.5
Commit: d4d18285931fc80860f6995687da166ea33e8dc7
Parents: 3393110
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Fri Sep 9 06:57:37 2016 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Fri Sep 9 07:00:59 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/d4d18285/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/d4d18285/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 45e323c..91b7ae2 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
@@ -253,6 +253,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/d4d18285/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


Mime
View raw message