You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2013/11/11 15:50:16 UTC

git commit: AMBARI-3736. HBase data directory in hdfs should be parsed from hbase.rootdir property. (Vitaly Brodetskyi via dlysnichenko)

Updated Branches:
  refs/heads/trunk 4626bf2d5 -> c24508645


AMBARI-3736. HBase data directory in hdfs should be parsed from hbase.rootdir property. (Vitaly Brodetskyi via dlysnichenko)


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

Branch: refs/heads/trunk
Commit: c24508645083126ac8b59ed1d63c4959c38be3e5
Parents: 4626bf2
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Nov 11 16:49:25 2013 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Nov 11 16:49:25 2013 +0200

----------------------------------------------------------------------
 .../modules/hdp-hadoop/manifests/namenode.pp    |  4 +-
 .../modules/hdp-hadoop/manifests/params.pp      |  3 ++
 .../modules/hdp-hbase/manifests/params.pp       |  2 -
 .../parser/functions/hdp_get_dir_from_url.rb    | 52 ++++++++++++++++++++
 .../main/puppet/modules/hdp/manifests/params.pp |  2 +-
 5 files changed, 58 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c2450864/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
index c33cdba..7dee7a3 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
@@ -143,8 +143,8 @@ define hdp-hadoop::namenode::create_app_directories($service_state)
     Hdp-hadoop::Hdfs::Directory['/mapred'] -> Hdp-hadoop::Hdfs::Directory['/mapred/system']
 
     if ($hdp::params::hbase_master_hosts != "") {
-      $hdfs_root_dir = $hdp::params::hbase_hdfs_root_dir
-      hdp-hadoop::hdfs::directory { $hdfs_root_dir:
+
+      hdp-hadoop::hdfs::directory { $hdp-hadoop::params::hdfs_root_dir:
         owner         => $hdp::params::hbase_user,
         service_state => $service_state
       }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c2450864/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
index 4b1fe64..5b9ebaa 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
@@ -27,6 +27,9 @@ class hdp-hadoop::params(
   ####  
   $conf_dir = $hdp::params::hadoop_conf_dir 
 
+  ####hbase
+  $hdfs_root_dir = $hdp::params::hbase_hdfs_root_dir
+
   ####### users
 
   $mapred_user = $hdp::params::mapred_user

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c2450864/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp
index 82b12bd..4eb5ad0 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/params.pp
@@ -39,8 +39,6 @@ class hdp-hbase::params() inherits hdp::params
   $hbase_regionserver_xmn_size = hdp_calc_xmn_from_xms("$hbase_regionserver_heapsize","0.2","512")
 
   ### hbase-site.xml
-  $hbase_hdfs_root_dir = hdp_default("hbase-site/hbase.hdfs.root.dir","/apps/hbase/data")
-
   $hbase_tmp_dir = hdp_default("hbase-site/hbase.tmp.dir","$hbase_log_dir")
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c2450864/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_dir_from_url.rb
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_dir_from_url.rb b/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_dir_from_url.rb
new file mode 100644
index 0000000..22d0ec6
--- /dev/null
+++ b/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_dir_from_url.rb
@@ -0,0 +1,52 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+# to get directory from URL string
+module Puppet::Parser::Functions
+  newfunction(:hdp_get_dir_from_url, :type => :rvalue) do |args|
+
+    if args.length > 1
+      default = args[1]
+    else
+      default = ""
+    end
+
+    if args.empty?
+      var = default
+    else
+      if args.kind_of?(Array)
+        splitArgsResult = args[0].split(":")
+      else
+        splitArgsResult = args.split(":")
+      end
+      if splitArgsResult.length != 3
+        var = default
+      else
+        strWithDir = splitArgsResult[2]
+        startIndexOfDir = strWithDir.index('/')
+        if startIndexOfDir == nil
+          var = default
+        else
+          var = strWithDir[startIndexOfDir, strWithDir.size - 1]
+        end
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c2450864/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
index c86b6e9..08aa89d 100644
--- a/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
@@ -243,7 +243,7 @@ class hdp::params()
   ############ Hdfs apps directories
   $hive_apps_whs_dir = hdp_default("hive_apps_whs_dir", "/apps/hive/warehouse")
   $webhcat_apps_dir = hdp_default("webhcat_apps_dir", "/apps/webhcat")
-  $hbase_hdfs_root_dir = hdp_default("hbase-site/hbase.hdfs.root.dir","/apps/hbase/data")
+  $hbase_hdfs_root_dir = hdp_get_dir_from_url(hdp_default("hbase-site/hbase.rootdir"),"/apps/hbase/data")
   $hbase_staging_dir = hdp_default("hbase-site/hbase.bulkload.staging.dir","/apps/hbase/staging")
 
   $yarn_nm_app_log_dir = hdp_default("yarn-site/yarn.nodemanager.remote-app-log-dir","/app-logs")