AMBARI-18994. In HA cluster copy the hdfs-site.xml and hbase-site.xml to Ranger 
conf directory (Mugdha Varadkar via smohanty)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 72b940e725658599f055a1c1eaadaa2a9c65075b
Parents: 4bfbf28
Author: Sumit Mohanty <smoha...@hortonworks.com>
Authored: Wed Nov 30 12:51:46 2016 -0800
Committer: Sumit Mohanty <smoha...@hortonworks.com>
Committed: Wed Nov 30 12:52:22 2016 -0800

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py      | 14 +++++++++++++
 .../0.4.0/package/scripts/setup_ranger_xml.py   | 21 ++++++++++++++++++++
 .../common-services/RANGER/0.6.0/metainfo.xml   |  2 ++
 3 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/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 6debaf1..e27b363 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
@@ -385,3 +385,17 @@ if audit_solr_enabled and is_solrCloud_enabled:
   # Check external solrCloud
   if is_external_solrCloud_enabled and is_external_solrCloud_kerberos:
     ranger_is_solr_kerberised = "true"
+
+hbase_master_hosts = default("/clusterHostInfo/hbase_master_hosts", [])
+is_hbase_ha_enabled = True if len(hbase_master_hosts) > 1 else False
+is_namenode_ha_enabled = True if len(namenode_hosts) > 1 else False
+ranger_hbase_plugin_enabled = False
+ranger_hdfs_plugin_enabled = False
+
+
+if is_hbase_ha_enabled:
+  if not 
is_empty(config['configurations']['ranger-hbase-plugin-properties']['ranger-hbase-plugin-enabled']):
+    ranger_hbase_plugin_enabled = 
config['configurations']['ranger-hbase-plugin-properties']['ranger-hbase-plugin-enabled'].lower()
 == 'yes'
+if is_namenode_ha_enabled:
+  if not 
is_empty(config['configurations']['ranger-hdfs-plugin-properties']['ranger-hdfs-plugin-enabled']):
+    ranger_hdfs_plugin_enabled = 
config['configurations']['ranger-hdfs-plugin-properties']['ranger-hdfs-plugin-enabled'].lower()
 == 'yes'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 316d207..8036f28 100644
--- 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -216,6 +216,27 @@ def setup_ranger_admin(upgrade_type=None):
 
   create_core_site_xml(ranger_conf)
 
+  if params.stack_supports_ranger_kerberos and params.security_enabled:
+    if params.is_hbase_ha_enabled and params.ranger_hbase_plugin_enabled:
+      XmlConfig("hbase-site.xml",
+        conf_dir=ranger_conf,
+        configurations=params.config['configurations']['hbase-site'],
+        
configuration_attributes=params.config['configuration_attributes']['hbase-site'],
+        owner=params.unix_user,
+        group=params.unix_group,
+        mode=0644
+      )
+
+    if params.is_namenode_ha_enabled and params.ranger_hdfs_plugin_enabled:
+      XmlConfig("hdfs-site.xml",
+        conf_dir=ranger_conf,
+        configurations=params.config['configurations']['hdfs-site'],
+        
configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
+        owner=params.unix_user,
+        group=params.unix_group,
+        mode=0644
+      )
+
 def setup_ranger_db(stack_version=None):
   import params
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/72b940e7/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 f330bc9..12fde7e 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
@@ -110,6 +110,8 @@
       <configuration-dependencies>
         <config-type>admin-log4j</config-type>
         <config-type>usersync-log4j</config-type>
+        <config-type>ranger-hdfs-plugin-properties</config-type>
+        <config-type>ranger-hbase-plugin-properties</config-type>
       </configuration-dependencies>
 
     </service>

Reply via email to