AMBARI-18386. Handle Ranger hive repo config jdbc url change for stack 2.5 
(mugdha)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: bdd261ef10eef1a5daa9d89f7b509bf6e23c370c
Parents: da56057
Author: Mugdha Varadkar <mug...@apache.org>
Authored: Thu Sep 15 10:37:06 2016 +0530
Committer: Mugdha Varadkar <mug...@apache.org>
Committed: Fri Sep 16 10:33:32 2016 +0530

----------------------------------------------------------------------
 .../resource_management/libraries/functions/constants.py  |  3 ++-
 .../HIVE/0.12.0.2.0/package/scripts/params_linux.py       | 10 +++++++++-
 .../stacks/HDP/2.0.6/properties/stack_features.json       |  5 +++++
 3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/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 169fbff..1396bd8 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
@@ -99,4 +99,5 @@ class StackFeature:
   RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change"
   STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes"
   SPARK_JAVA_OPTS_SUPPORT = "spark_java_opts_support"
-  ATLAS_HBASE_SETUP="atlas_hbase_setup"
+  ATLAS_HBASE_SETUP = "atlas_hbase_setup"
+  RANGER_HIVE_PLUGIN_JDBC_URL = "ranger_hive_plugin_jdbc_url"

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 56e3ce6..5f78a1f 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -89,6 +89,7 @@ version_for_stack_feature_checks = 
get_stack_feature_version(config)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
 stack_supports_ranger_kerberos = 
check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, 
version_for_stack_feature_checks)
 stack_supports_ranger_audit_db = 
check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, 
version_for_stack_feature_checks)
+stack_supports_ranger_hive_jdbc_url_change = 
check_stack_feature(StackFeature.RANGER_HIVE_PLUGIN_JDBC_URL, 
version_for_stack_feature_checks)
 
 # component ROLE directory (like hive-metastore or hive-server2-hive2)
 component_directory = status_params.component_directory
@@ -617,6 +618,9 @@ if has_hive_interactive:
     hive_llap_principal = 
(config['configurations']['hive-interactive-site']['hive.llap.zk.sm.principal']).replace('_HOST',hostname.lower())
   pass
 
+hive_server2_zookeeper_namespace = 
config['configurations']['hive-site']['hive.server2.zookeeper.namespace']
+hive_zookeeper_quorum = 
config['configurations']['hive-site']['hive.zookeeper.quorum']
+
 # ranger host
 ranger_admin_hosts = default("/clusterHostInfo/ranger_admin_hosts", [])
 has_ranger_admin = not len(ranger_admin_hosts) == 0
@@ -688,11 +692,15 @@ if has_ranger_admin:
   ranger_previous_jdbc_jar = 
format("{hive_lib}/{ranger_previous_jdbc_jar_name}") if 
stack_supports_ranger_audit_db else None
   sql_connector_jar = ''
 
+  ranger_hive_url = format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url
+  if stack_supports_ranger_hive_jdbc_url_change:
+    ranger_hive_url = 
format("jdbc:hive2://{hive_zookeeper_quorum}/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace={hive_server2_zookeeper_namespace}")
+
   hive_ranger_plugin_config = {
     'username': repo_config_username,
     'password': repo_config_password,
     'jdbc.driverClassName': jdbc_driver_class_name,
-    'jdbc.url': format("{hive_url}/default;principal={hive_principal}") if 
security_enabled else hive_url,
+    'jdbc.url': ranger_hive_url,
     'commonNameForCertificate': common_name_for_certificate
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bdd261ef/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 8c838db..dbde58b 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
@@ -303,6 +303,11 @@
       "name": "atlas_hbase_setup",
       "description": "Use script to create Atlas tables in Hbase and set 
permissions for Atlas user.",
       "min_version": "2.5.0.0"
+    },
+    {
+      "name": "ranger_hive_plugin_jdbc_url",
+      "description": "Handle Ranger hive repo config jdbc url change for stack 
2.5 (AMBARI-18386)",
+      "min_version": "2.5.0.0"
     }
   ]
 }

Reply via email to