ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-17642. Changes to stack advisor framework to help with service advisors (rlevas)
Date Mon, 11 Jul 2016 13:40:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a377f74f2 -> bc8791ef7


AMBARI-17642. Changes to stack advisor framework to help with service advisors (rlevas)


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

Branch: refs/heads/trunk
Commit: bc8791ef7cedd000b85888077cfa20b6c4ba1964
Parents: a377f74
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Mon Jul 11 09:33:55 2016 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Mon Jul 11 09:34:03 2016 -0400

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py    | 14 --------------
 .../stacks/HDP/2.3/services/stack_advisor.py      |  2 +-
 .../src/main/resources/stacks/stack_advisor.py    | 18 +++++++++++++++++-
 3 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc8791ef/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 3f66216..c2dfd88 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
@@ -1649,20 +1649,6 @@ def getOldValue(self, services, configType, propertyName):
   return None
 
 # Validation helper methods
-def isSecurityEnabled(services):
-  """
-  Determines if security is enabled by testing the value of cluster-env/security enabled.
-
-  If the property exists and is equal to "true", then is it enabled; otherwise is it assumed
to be
-  disabled.
-
-  :param services: the services structure containing the current configurations
-  :return: true if security is enabled; otherwise false
-  """
-  return "cluster-env" in services["configurations"] \
-         and "security_enabled" in services["configurations"]["cluster-env"]["properties"]
\
-         and services["configurations"]["cluster-env"]["properties"]["security_enabled"].lower()
== "true"
-
 def getSiteProperties(configurations, siteName):
   siteConfig = configurations.get(siteName)
   if siteConfig is None:

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc8791ef/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
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 990c314..2a2a3a3 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
@@ -297,7 +297,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
     kafka_broker = getServicesSiteProperties(services, "kafka-broker")
 
-    security_enabled = isSecurityEnabled(services)
+    security_enabled = self.isSecurityEnabled(services)
 
     putKafkaBrokerProperty = self.putProperty(configurations, "kafka-broker", services)
     putKafkaLog4jProperty = self.putProperty(configurations, "kafka-log4j", services)

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc8791ef/ambari-server/src/main/resources/stacks/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py
index 23c0320..7c6470f 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -349,7 +349,9 @@ class DefaultStackAdvisor(StackAdvisor):
         if hasattr(serviceAdvisor, className):
           print "ServiceAdvisor implementation for service {0} was loaded".format(serviceName)
           return getattr(serviceAdvisor, className)()
-
+        else:
+          print "Failed to load or create ServiceAdvisor implementation for service {0}:
" \
+                "Expecting class name {1} but it was not found.".format(serviceName, className)
       except Exception as e:
         traceback.print_exc()
         print "Failed to load or create ServiceAdvisor implementation for service {0}".format(serviceName)
@@ -1036,3 +1038,17 @@ class DefaultStackAdvisor(StackAdvisor):
   def getHosts(self, componentsList, componentName):
     hostNamesList = [component["hostnames"] for component in componentsList if component["component_name"]
== componentName]
     return hostNamesList[0] if len(hostNamesList) > 0 else []
+
+  def isSecurityEnabled(self, services):
+    """
+    Determines if security is enabled by testing the value of cluster-env/security enabled.
+
+    If the property exists and is equal to "true", then is it enabled; otherwise is it assumed
to be
+    disabled.
+
+    :param services: the services structure containing the current configurations
+    :return: true if security is enabled; otherwise false
+    """
+    return "cluster-env" in services["configurations"] \
+           and "security_enabled" in services["configurations"]["cluster-env"]["properties"]
\
+           and services["configurations"]["cluster-env"]["properties"]["security_enabled"].lower()
== "true"


Mime
View raw message