Repository: ambari
Updated Branches:
  refs/heads/trunk 3107ac10f -> dd48a4c52


AMBARI-6951. BE: Bad request error thrown during configs-validation


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

Branch: refs/heads/trunk
Commit: dd48a4c5253bba9be36cf3a86a22b27a14c9edde
Parents: 3107ac1
Author: Srimanth Gunturi <sgunt...@hortonworks.com>
Authored: Wed Aug 20 11:16:31 2014 -0700
Committer: Srimanth Gunturi <sgunt...@hortonworks.com>
Committed: Wed Aug 20 11:31:41 2014 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 20 ++++++++++------
 ambari-web/app/styles/application.less          | 24 ++++++++++----------
 2 files changed, 25 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dd48a4c5/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 69fb23a..ad0dcc0 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
@@ -401,8 +401,11 @@ class HDP206StackAdvisor(StackAdvisor):
       if validator is not None:
         siteName = validator[0]
         method = validator[1]
-        resultItems = method(getSiteProperties(configurations, siteName), 
recommendedDefaults[siteName]["properties"])
-        items.extend(resultItems)
+        if siteName in recommendedDefaults:
+          siteProperties = getSiteProperties(configurations, siteName)
+          if siteProperties is not None:
+            resultItems = method(siteProperties, 
recommendedDefaults[siteName]["properties"])
+            items.extend(resultItems)
     return validations
     pass
 
@@ -421,6 +424,8 @@ class HDP206StackAdvisor(StackAdvisor):
     return result
 
   def validatorLessThenDefaultValue(self, properties, recommendedDefaults, 
propertyName):
+    if not propertyName in properties:
+      return "Value should be set"
     value = to_number(properties[propertyName])
     if value is None:
       return "Value should be integer"
@@ -432,6 +437,8 @@ class HDP206StackAdvisor(StackAdvisor):
     return None
 
   def validateXmxValue(self, properties, recommendedDefaults, propertyName):
+    if not propertyName in properties:
+      return "Value should be set"
     value = properties[propertyName]
     defaultValue = recommendedDefaults[propertyName]
     if defaultValue is None:
@@ -464,11 +471,10 @@ class HDP206StackAdvisor(StackAdvisor):
 
 # Validation helper methods
 def getSiteProperties(configurations, siteName):
-  if configurations[siteName] is None:
-    return {}
-  if configurations[siteName]["properties"] is None:
-    return {}
-  return configurations[siteName]["properties"]
+  siteConfig = configurations.get(siteName)
+  if siteConfig is None:
+    return None
+  return siteConfig.get("properties")
 
 def to_number(s):
   try:

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd48a4c5/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less 
b/ambari-web/app/styles/application.less
index 5a41535..7d9d175 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -1184,18 +1184,18 @@ h1 {
   .common-config-category {
     .action {
       cursor: pointer;
-      .icon-plus-sign {
-        color: #5AB400;
-        margin-right: 2px;
-      }
-      .icon-minus-sign {
-        color: #FF4B4B;
-        margin-right: 2px;
-      }
-      .icon-undo {
-        color: rgb(243, 178, 11);
-        margin-right: 2px;
-      }
+    }
+    .icon-plus-sign {
+      color: #5AB400;
+      margin-right: 2px;
+    }
+    .icon-minus-sign {
+      color: #FF4B4B;
+      margin-right: 2px;
+    }
+    .icon-undo {
+      color: rgb(243, 178, 11);
+      margin-right: 2px;
     }
     .btn-final .icon-lock {
       color: grey;

Reply via email to