AMBARI-18445. SmartSense error during host assignment (aonishuk)

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

Branch: refs/heads/branch-2.5
Commit: b2c56544f609514264e9f096edd03288de405485
Parents: feb0dda
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Thu Sep 22 16:57:38 2016 +0300
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Thu Sep 22 16:57:38 2016 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py          |  7 ++++---
 .../python/stacks/2.0.6/common/test_stack_advisor.py    | 12 ++++++++----
 .../test/python/stacks/2.5/common/test_stack_advisor.py |  5 ++++-
 3 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b2c56544/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 047f3b2..e213205 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -65,21 +65,22 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
          if "+" in cardinality:
            hostsMin = int(cardinality[:-1])
            if componentHostsCount < hostsMin:
-             message = "At least {0} {1} components should be installed in 
cluster.".format(hostsMin, componentDisplayName)
+             message = "at least {0} {1} components should be installed in 
cluster.".format(hostsMin, componentDisplayName)
          elif "-" in cardinality:
            nums = cardinality.split("-")
            hostsMin = int(nums[0])
            hostsMax = int(nums[1])
            if componentHostsCount > hostsMax or componentHostsCount < hostsMin:
-             message = "Between {0} and {1} {2} components should be installed 
in cluster.".format(hostsMin, hostsMax, componentDisplayName)
+             message = "between {0} and {1} {2} components should be installed 
in cluster.".format(hostsMin, hostsMax, componentDisplayName)
          elif "ALL" == cardinality:
            if componentHostsCount != hostsCount:
              message = "{0} component should be installed on all hosts in 
cluster.".format(componentDisplayName)
          else:
            if componentHostsCount != int(cardinality):
-             message = "Exactly {0} {1} components should be installed in 
cluster.".format(int(cardinality), componentDisplayName)
+             message = "exactly {0} {1} components should be installed in 
cluster.".format(int(cardinality), componentDisplayName)
 
          if message is not None:
+           message = "You have selected {0} {1} components. Please consider 
that {2}".format(componentHostsCount, componentDisplayName, message)
            items.append({"type": 'host-component', "level": 'ERROR', 
"message": message, "component-name": componentName})
 
     # Validating host-usage

http://git-wip-us.apache.org/repos/asf/ambari/blob/b2c56544/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index a70922f..cd69dc3 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -146,7 +146,8 @@ class TestHDP206StackAdvisor(TestCase):
     result = self.stackAdvisor.validateComponentLayout(services, hosts)
 
     expectedItems = [
-      {"message": "Ganglia Monitor component should be installed on all hosts 
in cluster.", "level": "ERROR"}
+      {"message": "You have selected 1 Ganglia Monitor components. Please 
consider that Ganglia Monitor component should be installed on all hosts in 
cluster.",
+       "level": "ERROR"}
     ]
     self.assertValidationResult(expectedItems, result)
 
@@ -165,7 +166,8 @@ class TestHDP206StackAdvisor(TestCase):
     result = self.stackAdvisor.validateComponentLayout(services, hosts)
 
     expectedItems = [
-      {"message": "Exactly 2 Ganglia Monitor components should be installed in 
cluster.", "level": "ERROR"}
+      {"message": "You have selected 1 Ganglia Monitor components. Please 
consider that exactly 2 Ganglia Monitor components should be installed in 
cluster.",
+       "level": "ERROR"}
     ]
     self.assertValidationResult(expectedItems, result)
 
@@ -184,7 +186,8 @@ class TestHDP206StackAdvisor(TestCase):
     result = self.stackAdvisor.validateComponentLayout(services, hosts)
 
     expectedItems = [
-      {"message": "At least 3 Ganglia Server components should be installed in 
cluster.", "level": "ERROR"}
+      {"message": "You have selected 2 Ganglia Server components. Please 
consider that at least 3 Ganglia Server components should be installed in 
cluster.",
+       "level": "ERROR"}
     ]
     self.assertValidationResult(expectedItems, result)
 
@@ -361,7 +364,8 @@ class TestHDP206StackAdvisor(TestCase):
     result = self.stackAdvisor.validateComponentLayout(services, hosts)
 
     expectedItems = [
-      {"message": "Between 0 and 1 Ganglia Server components should be 
installed in cluster.", "level": "ERROR"}
+      {"message": "You have selected 2 Ganglia Server components. Please 
consider that between 0 and 1 Ganglia Server components should be installed in 
cluster.",
+       "level": "ERROR"}
     ]
     self.assertValidationResult(expectedItems, result)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b2c56544/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
index 0ed1761..72e59aa 100644
--- a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
@@ -436,7 +436,10 @@ class TestHDP25StackAdvisor(TestCase):
     services = self.load_json("services-normal-his-2-hosts.json")
 
     validations = self.stackAdvisor.getComponentLayoutValidations(services, 
hosts)
-    expected = {'component-name': 'HIVE_SERVER_INTERACTIVE', 'message': 
'Between 0 and 1 HiveServer2 Interactive components should be installed in 
cluster.', 'type': 'host-component', 'level': 'ERROR'}
+    expected = {'component-name': 'HIVE_SERVER_INTERACTIVE',
+                'message': 'You have selected 2 HiveServer2 Interactive 
components. Please consider that between 0 and 1 HiveServer2 Interactive 
components should be installed in cluster.',
+                'type': 'host-component',
+                'level': 'ERROR'}
     self.assertEquals(validations[0], expected)
 
 

Reply via email to