This is an automated email from the ASF dual-hosted git repository.

swagle pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 3037730  AMBARI-23116 Add empty kafka broker handling to stackadvisor 
(#508)
3037730 is described below

commit 3037730bd2fcf6858b5292852724c41c0606f284
Author: majorendre <34535487+majoren...@users.noreply.github.com>
AuthorDate: Thu Mar 1 22:45:29 2018 +0100

    AMBARI-23116 Add empty kafka broker handling to stackadvisor (#508)
    
    * AMBARI-23116 added emty kafka broker handling to stackadvisor
    
    * AMBARI-23116 fixed unit test and removed unnecessary check
---
 .../src/main/resources/stacks/HDP/2.3/services/stack_advisor.py    | 7 +++++--
 .../src/test/python/stacks/2.3/common/test_stack_advisor.py        | 5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)

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 80b2033..ca5ed4d 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
@@ -337,6 +337,10 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
 
     servicesList = [service["StackServices"]["service_name"] for service in 
services["services"]]
     kafka_broker = getServicesSiteProperties(services, "kafka-broker")
+    kafka_env = getServicesSiteProperties(services, "kafka-env")
+
+    if not kafka_env: #Kafka check not required
+      return
 
     security_enabled = self.isSecurityEnabled(services)
 
@@ -345,8 +349,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
     putKafkaBrokerAttributes = self.putPropertyAttribute(configurations, 
"kafka-broker")
 
     if security_enabled:
-      kafka_env = getServicesSiteProperties(services, "kafka-env")
-      kafka_user = kafka_env.get('kafka_user') if kafka_env is not None else 
None
+      kafka_user = kafka_env.get('kafka_user')
 
       if kafka_user is not None:
         kafka_super_users = kafka_broker.get('super.users') if kafka_broker is 
not None else None
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 689e25a..129174c 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
@@ -324,6 +324,11 @@ class TestHDP23StackAdvisor(TestCase):
           },
           "property_attributes": {}
         },
+        "kafka-env": {
+          "properties": {
+            "kafka_user" : "custom_kafka"
+          }
+        },
         "kafka-broker": {
           "properties": {
             "authorizer.class.name" : "kafka.security.auth.SimpleAclAuthorizer"

-- 
To stop receiving notification emails like this one, please contact
swa...@apache.org.

Reply via email to