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/12/09 21:57:38 UTC

[46/51] [abbrv] ambari git commit: AMBARI-19114. Add property existence check to druid stack advisor code (Nishant Bangarwa via smohanty)

AMBARI-19114. Add property existence check to druid stack advisor code (Nishant Bangarwa via smohanty)


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

Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 2a840811896ddb84343dea1db12842ef35e30d3d
Parents: 6029846
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri Dec 9 06:58:15 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri Dec 9 06:58:15 2016 -0800

----------------------------------------------------------------------
 .../stacks/HDP/2.6/services/stack_advisor.py    |  4 ++
 .../stacks/2.6/common/test_stack_advisor.py     | 52 ++++++++++++++++++++
 2 files changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a840811/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index bebeaf8..562444b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -53,6 +53,10 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
 
   def recommendDruidConfigurations(self, configurations, clusterData, services, hosts):
 
+      # druid is not in list of services to be installed
+      if 'druid-common' not in services['configurations']:
+        return
+
       componentsListList = [service["components"] for service in services["services"]]
       componentsList = [item["StackServiceComponents"] for sublist in componentsListList for item in sublist]
       servicesList = [service["StackServices"]["service_name"] for service in services["services"]]

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a840811/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
index 011a874..074d87e 100644
--- a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
@@ -424,6 +424,58 @@ class TestHDP26StackAdvisor(TestCase):
                                                               'druid.broker.jvm.heap.memory': {'maximum': '49152'}}}}
                       )
 
+
+  def test_recommendDruidConfigurations_property_existence_check(self):
+      # Test for https://issues.apache.org/jira/browse/AMBARI-19144
+      hosts = {
+        "items": [
+          {
+            "Hosts": {
+              "cpu_count": 4,
+              "total_mem": 50331648,
+              "disk_info": [
+                {"mountpoint": "/"},
+                {"mountpoint": "/dev/shm"},
+                {"mountpoint": "/vagrant"},
+                {"mountpoint": "/"},
+                {"mountpoint": "/dev/shm"},
+                {"mountpoint": "/vagrant"}
+              ],
+              "public_host_name": "c6401.ambari.apache.org",
+              "host_name": "c6401.ambari.apache.org"
+            }
+          }
+        ]
+      }
+
+      services = {
+        "Versions": {
+          "parent_stack_version": "2.5",
+          "stack_name": "HDP",
+          "stack_version": "2.6",
+          "stack_hierarchy": {
+            "stack_name": "HDP",
+            "stack_versions": ["2.5", "2.4", "2.3", "2.2", "2.1", "2.0.6"]
+          }
+        },
+        "services": [{
+        }
+        ],
+        "configurations": {
+        }
+      }
+
+      clusterData = {
+      }
+
+      configurations = {
+      }
+
+      self.stackAdvisor.recommendDruidConfigurations(configurations, clusterData, services, hosts)
+      self.assertEquals(configurations,
+                        {}
+                        )
+
   def test_recommendDruidConfigurations_heterogeneous_hosts(self):
     hosts = {
       "items": [