You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ga...@apache.org on 2016/04/19 10:51:01 UTC

ambari git commit: AMBARI-15906. Make Ranger TagSync to be installed as a slave and optional (Mugdha Varadkar via gautam)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6c192789f -> 1faa5acd4


AMBARI-15906. Make Ranger TagSync to be installed as a slave and optional (Mugdha Varadkar via gautam)


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

Branch: refs/heads/trunk
Commit: 1faa5acd4102ac8299596445df7744ed26d34d0f
Parents: 6c19278
Author: Gautam Borad <ga...@apache.org>
Authored: Tue Apr 19 13:53:24 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Tue Apr 19 14:20:44 2016 +0530

----------------------------------------------------------------------
 .../libraries/functions/package_conditions.py   |  3 ++-
 .../configuration/ranger-tagsync-site.xml       |  2 +-
 .../stacks/HDP/2.5/services/RANGER/metainfo.xml | 13 +++++----
 .../stacks/HDP/2.5/services/stack_advisor.py    | 28 +++++++++++++++++---
 4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1faa5acd/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
index 4466671..1544ffe 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
@@ -79,6 +79,7 @@ def should_install_kerberos_server():
 def should_install_ranger_tagsync():
   config = Script.get_config()
   ranger_tagsync_hosts = default("/clusterHostInfo/ranger_tagsync_hosts", [])
+  ranger_tagsync_enabled = default('/configurations/ranger-tagsync-site/ranger.tagsync.enabled', False)
   has_ranger_tagsync = len(ranger_tagsync_hosts) > 0
 
-  return has_ranger_tagsync
\ No newline at end of file
+  return has_ranger_tagsync or ranger_tagsync_enabled
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1faa5acd/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/configuration/ranger-tagsync-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/configuration/ranger-tagsync-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/configuration/ranger-tagsync-site.xml
index cfcab3b..9ffc59f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/configuration/ranger-tagsync-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/configuration/ranger-tagsync-site.xml
@@ -24,7 +24,7 @@
   <property>
     <name>ranger.tagsync.enabled</name>
     <display-name>Enable Tagsync</display-name>
-    <value>true</value>
+    <value>false</value>
     <description>Enable/Disable Ranger Tagsync</description>
     <value-attributes>
       <empty-value-valid>true</empty-value-valid>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1faa5acd/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/metainfo.xml
index 9f96308..b4c49f3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER/metainfo.xml
@@ -29,14 +29,18 @@
         <component>
           <name>RANGER_TAGSYNC</name>
           <displayName>Ranger Tagsync</displayName>
-          <category>MASTER</category>
-          <cardinality>1</cardinality>
+          <category>SLAVE</category>
+          <cardinality>0-1</cardinality>
           <versionAdvertised>true</versionAdvertised>
           <commandScript>
             <script>scripts/ranger_tagsync.py</script>
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <configuration-dependencies>
+            <config-type>ranger-tagsync-site</config-type>
+            <config-type>tagsync-application-properties</config-type>
+          </configuration-dependencies>
         </component>
       </components>
 
@@ -47,11 +51,6 @@
         </theme>
       </themes>
 
-      <configuration-dependencies>
-        <config-type>ranger-tagsync-site</config-type>
-        <config-type>tagsync-application-properties</config-type>
-      </configuration-dependencies>
-
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1faa5acd/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index 45d5a52..eee2fa2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -47,7 +47,8 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     parentValidators = super(HDP25StackAdvisor, self).getServiceConfigurationValidators()
     childValidators = {
       "HIVE": {"hive-interactive-env": self.validateHiveInteractiveEnvConfigurations},
-      "YARN": {"yarn-site": self.validateYarnConfigurations}
+      "YARN": {"yarn-site": self.validateYarnConfigurations},
+      "RANGER": {"ranger-tagsync-site": self.validateRangerTagsyncConfigurations}
     }
     self.mergeValidators(parentValidators, childValidators)
     return parentValidators
@@ -420,15 +421,19 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
 
     putTagsyncAppProperty = self.putProperty(configurations, "tagsync-application-properties", services)
+    has_ranger_tagsync = False
+    if 'RANGER' in servicesList:
+      ranger_tagsync_host = self.__getHostsForComponent(services, "RANGER", "RANGER_TAGSYNC")
+      has_ranger_tagsync = len(ranger_tagsync_host) > 0
 
     zookeeper_host_port = self.getZKHostPortString(services)
-    if zookeeper_host_port:
+    if zookeeper_host_port and has_ranger_tagsync:
       zookeeper_host_list = zookeeper_host_port.split(',')
       putTagsyncAppProperty('atlas.kafka.zookeeper.connect', zookeeper_host_list[0])
     else:
       putTagsyncAppProperty('atlas.kafka.zookeeper.connect', 'localhost:6667')
 
-    if 'KAFKA' in servicesList:
+    if 'KAFKA' in servicesList and has_ranger_tagsync:
       kafka_hosts = self.getHostNamesWithComponent("KAFKA", "KAFKA_BROKER", services)
       kafka_port = '6667'
       if 'kafka-broker' in services['configurations'] and (
@@ -443,6 +448,23 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     else:
       putTagsyncAppProperty('atlas.kafka.bootstrap.servers', 'localhost:2181')
 
+  def validateRangerTagsyncConfigurations(self, properties, recommendedDefaults, configurations, services, hosts):
+    ranger_tagsync_properties = getSiteProperties(configurations, "ranger-tagsync-site")
+    validationItems = []
+
+    has_ranger_tagsync = False
+    if "RANGER" in servicesList:
+      ranger_tagsync_host = self.__getHostsForComponent(services, "RANGER", "RANGER_TAGSYNC")
+      has_ranger_tagsync = len(ranger_tagsync_host) == 0
+
+      if has_ranger_tagsync and 'ranger.tagsync.enabled' in ranger_tagsync_properties and \
+        ranger_tagsync_properties['ranger.tagsync.enabled'].lower() == 'true':
+        validationItems.append({"config-name": "ranger.tagsync.enabled",
+                                  "item": self.getWarnItem(
+                                    "Need to Install RANGER TAGSYNC component to set ranger.tagsync.enabled as true.")})
+
+    return self.toConfigurationValidationProblems(validationItems, "ranger-tagsync-site")
+
   """
   Returns the host(s) on which a requested service's component is hosted.
   Parameters :