AMBARI-15157. Cannot change hive.metastore.warehouse.dir to S3 (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4c9c3c57 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4c9c3c57 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4c9c3c57 Branch: refs/heads/branch-2.2 Commit: 4c9c3c575ea3c0b46be59d576a458ce413b98c6b Parents: 4d8bc0f Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Thu Feb 25 19:13:50 2016 +0200 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Thu Feb 25 19:13:50 2016 +0200 ---------------------------------------------------------------------- .../HIVE/0.12.0.2.0/package/scripts/hive.py | 20 ++++++++++++-------- .../0.12.0.2.0/package/scripts/params_linux.py | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4c9c3c57/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py index 39b3433..f383e8f 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py @@ -177,14 +177,18 @@ def hive(name=None): host_sys_prepped=params.host_sys_prepped) # ******* End Copy Tarballs ******* # ********************************* - - # Create Hive Metastore Warehouse Dir - params.HdfsResource(params.hive_apps_whs_dir, - type="directory", - action="create_on_execute", - owner=params.hive_user, - mode=0777 - ) + + # if warehouse directory is in DFS + if not params.whs_dir_protocol or params.whs_dir_protocol == urlparse(params.default_fs).scheme: + # Create Hive Metastore Warehouse Dir + params.HdfsResource(params.hive_apps_whs_dir, + type="directory", + action="create_on_execute", + owner=params.hive_user, + mode=0777 + ) + else: + Logger.info(format("Not creating warehouse directory '{hive_apps_whs_dir}', as the location is not in DFS.")) # Create Hive User Dir params.HdfsResource(params.hive_hdfs_user_dir, http://git-wip-us.apache.org/repos/asf/ambari/blob/4c9c3c57/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 a66b6d0..e25a9a0 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 @@ -22,6 +22,8 @@ import status_params import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set. import os +from urlparse import urlparse + from ambari_commons.constants import AMBARI_SUDO_BINARY from ambari_commons.os_check import OSCheck @@ -357,6 +359,7 @@ hive_env_sh_template = config['configurations']['hive-env']['content'] hive_hdfs_user_dir = format("/user/{hive_user}") hive_hdfs_user_mode = 0755 hive_apps_whs_dir = config['configurations']['hive-site']["hive.metastore.warehouse.dir"] +whs_dir_protocol = urlparse(hive_apps_whs_dir).scheme hive_exec_scratchdir = config['configurations']['hive-site']["hive.exec.scratchdir"] #for create_hdfs_directory hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']