Repository: ambari
Updated Branches:
  refs/heads/trunk a94a03f55 -> b30a7b561


AMBARI-16922. Remove LogSearch dependency for Ranger (Mugdha Varadkar via 
oleewere)


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

Branch: refs/heads/trunk
Commit: b30a7b5614b136b4ca267b5fd1d6ab920332c0e3
Parents: a94a03f
Author: oleewere <[email protected]>
Authored: Fri May 27 20:54:47 2016 +0200
Committer: oleewere <[email protected]>
Committed: Fri May 27 20:54:47 2016 +0200

----------------------------------------------------------------------
 .../libraries/functions/constants.py            |  2 +-
 .../libraries/functions/stack_features.py       |  4 +--
 .../RANGER/0.4.0/package/scripts/params.py      | 12 ++++++++-
 .../0.4.0/package/scripts/ranger_admin.py       |  2 +-
 .../common-services/RANGER/0.6.0/metainfo.xml   | 16 ------------
 .../HDP/2.0.6/properties/stack_features.json    |  4 +--
 .../stacks/HDP/2.5/services/stack_advisor.py    | 27 ++++++++++----------
 7 files changed, 30 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 455fb67..eba1abf 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -82,5 +82,5 @@ class StackFeature:
   RANGER_KERBEROS_SUPPORT = "ranger_kerberos_support"
   HIVE_METASTORE_SITE_SUPPORT = "hive_metastore_site_support"
   RANGER_USERSYNC_PASSWORD_JCEKS = "ranger_usersync_password_jceks"
-  RANGER_LOGSEARCH_DEPENDENT = "ranger_logsearch_dependent"
+  LOGSEARCH_SUPPORT = "logsearch_support"
   HBASE_HOME_DIRECTORY = "hbase_home_directory"

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
index e9b7e6f..9a3fa31 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py
@@ -240,8 +240,8 @@ _DEFAULT_STACK_FEATURES = {
       "min_version": "2.5.0.0"
     },
     {
-      "name": "ranger_logsearch_dependent",
-      "description": "Ranger audit properties should be configured to use 
Ambari installed LogSearch (AMBARI-16446)",
+      "name": "logsearch_support",
+      "description": "LogSearch Service support",
       "min_version": "2.5.0.0"
     },
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
index 539a57c..29ac561 100644
--- 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
@@ -64,7 +64,7 @@ stack_supports_ranger_audit_db = stack_version_formatted and 
check_stack_feature
 stack_supports_ranger_log4j =  stack_version_formatted and 
check_stack_feature(StackFeature.RANGER_LOG4J_SUPPORT, stack_version_formatted)
 stack_supports_ranger_kerberos = stack_version_formatted and 
check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, 
stack_version_formatted)
 stack_supports_usersync_passwd = stack_version_formatted and 
check_stack_feature(StackFeature.RANGER_USERSYNC_PASSWORD_JCEKS, 
stack_version_formatted)
-stack_supports_logsearch_dependent = stack_version_formatted and 
check_stack_feature(StackFeature.RANGER_LOGSEARCH_DEPENDENT, 
stack_version_formatted)
+stack_supports_logsearch = stack_version_formatted and 
check_stack_feature(StackFeature.LOGSEARCH_SUPPORT, stack_version_formatted)
 
 downgrade_from_version = default("/commandParams/downgrade_from_version", None)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
@@ -266,6 +266,16 @@ ranger_solr_conf = 
format('{ranger_home}/contrib/solr_for_audit_setup/conf')
 logsearch_solr_hosts = default("/clusterHostInfo/logsearch_solr_hosts", [])
 replication_factor = 2 if len(logsearch_solr_hosts) > 1 else 1
 has_logsearch = len(logsearch_solr_hosts) > 0
+is_solrCloud_enabled = 
default('/configurations/ranger-env/is_solrCloud_enabled', False)
+zookeeper_port = default('/configurations/zoo.cfg/clientPort', None)
+# get comma separated list of zookeeper hosts from clusterHostInfo
+index = 0
+zookeeper_quorum = ""
+for host in config['clusterHostInfo']['zookeeper_hosts']:
+  zookeeper_quorum += host + ":" + str(zookeeper_port)
+  index += 1
+  if index < len(config['clusterHostInfo']['zookeeper_hosts']):
+    zookeeper_quorum += ","
 
 # logic to create core-site.xml if hdfs not installed
 if stack_supports_ranger_kerberos and not has_namenode:

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
index 2a3803b..cedb3f9 100644
--- 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
@@ -75,7 +75,7 @@ class RangerAdmin(Script):
     env.set_params(params)
     self.configure(env, upgrade_type=upgrade_type)
 
-    if params.stack_supports_logsearch_dependent and params.has_logsearch:
+    if params.stack_supports_logsearch and params.has_logsearch and 
params.is_solrCloud_enabled:
       setup_ranger_audit_solr()
     ranger_service('ranger_admin')
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
index a364418..6f1460a 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.6.0/metainfo.xml
@@ -27,18 +27,6 @@
       <version>0.6.0</version>
 
       <components>
-        <component>
-          <name>RANGER_ADMIN</name>
-          <dependencies>
-            <dependency>
-              <name>LOGSEARCH/LOGSEARCH_SOLR_CLIENT</name>
-              <scope>host</scope>
-              <auto-deploy>
-                <enabled>true</enabled>
-              </auto-deploy>
-            </dependency>
-          </dependencies>
-        </component>
 
         <component>
           <name>RANGER_TAGSYNC</name>
@@ -65,10 +53,6 @@
         </theme>
       </themes>
 
-      <requiredServices>
-        <service>LOGSEARCH</service>
-      </requiredServices>
-
       <configuration-dependencies>
         <config-type>admin-log4j</config-type>
         <config-type>usersync-log4j.xml</config-type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index f180aca..99a3ade 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -222,8 +222,8 @@
       "min_version": "2.5.0.0"
     },
     {
-      "name": "ranger_logsearch_dependent",
-      "description": "Ranger audit properties should be configured to use 
Ambari installed LogSearch (AMBARI-16446)",
+      "name": "logsearch_support",
+      "description": "LogSearch Service support",
       "min_version": "2.5.0.0"
     },
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b30a7b56/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 34bed51..47f27ec 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
@@ -1114,29 +1114,28 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     else:
       putTagsyncAppProperty('atlas.kafka.bootstrap.servers', 'localhost:6667')
 
-    if 'LOGSEARCH' in servicesList and zookeeper_host_port:
-      putRangerEnvProperty('is_solrCloud_enabled', 'true')
+    if 'ranger-env' in services['configurations'] and 'is_solrCloud_enabled' 
in services['configurations']["ranger-env"]["properties"]:
+      isSolrCloudEnabled = 
services['configurations']["ranger-env"]["properties"]["is_solrCloud_enabled"]  
== "true"
+    else:
+      isSolrCloudEnabled = False
+
+    ranger_audit_zk_port = ''
+
+    if 'LOGSEARCH' in servicesList and zookeeper_host_port and 
is_solrCloud_enabled:
       zookeeper_host_port = zookeeper_host_port.split(',')
       zookeeper_host_port.sort()
       zookeeper_host_port = ",".join(zookeeper_host_port)
-      logsearch_solr_znode = '/logsearch'
-      ranger_audit_zk_port = ''
+      logsearch_solr_znode = '/ambari-solr'
+
       if 'logsearch-solr-env' in services['configurations'] and \
         ('logsearch_solr_znode' in 
services['configurations']['logsearch-solr-env']['properties']):
         logsearch_solr_znode = 
services['configurations']['logsearch-solr-env']['properties']['logsearch_solr_znode']
         ranger_audit_zk_port = '{0}{1}'.format(zookeeper_host_port, 
logsearch_solr_znode)
       putRangerAdminProperty('ranger.audit.solr.zookeepers', 
ranger_audit_zk_port)
+    elif zookeeper_host_port and is_solrCloud_enabled:
+      ranger_audit_zk_port = '{0}/{1}'.format(zookeeper_host_port, 
'ranger_audits')
+      putRangerAdminProperty('ranger.audit.solr.zookeepers', 
ranger_audit_zk_port)
     else:
-      putRangerEnvProperty('is_solrCloud_enabled', 'false')
-
-    if 'ranger-env' in configurations and 
configurations["ranger-env"]["properties"]["is_solrCloud_enabled"]:
-      isSolrCloudEnabled = configurations and 
configurations["ranger-env"]["properties"]["is_solrCloud_enabled"] == "true"
-    elif 'ranger-env' in services['configurations'] and 'is_solrCloud_enabled' 
in services['configurations']["ranger-env"]["properties"]:
-      isSolrCloudEnabled = 
services['configurations']["ranger-env"]["properties"]["is_solrCloud_enabled"]  
== "true"
-    else:
-      isSolrCloudEnabled = False
-
-    if not isSolrCloudEnabled:
       putRangerAdminProperty('ranger.audit.solr.zookeepers', 'NONE')
 
     ranger_services = [

Reply via email to