浏览代码

AMBARI-3061. Do not use regex to determine folder name by full path for dfs_domain_socket_path. (Dmitry Sen via odiachenko)

Oleksandr Diachenko 12 年之前
父节点
当前提交
dd33e55e50

+ 3 - 2
ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp

@@ -268,10 +268,11 @@ class hdp-hadoop(
         owner => 'root'
     }
 
-    $dfs_domain_socket_path_dir = regsubst($hdp-hadoop::params::dfs_domain_socket_path, '/[^\/]+$', '')
+    $dfs_domain_socket_path_dir = hdp_get_directory_from_filepath($hdp-hadoop::params::dfs_domain_socket_path)
     hdp::directory_recursive_create { $dfs_domain_socket_path_dir:
       owner => $hdfs_user,
-      group => $hdp::params::user_group
+      group => $hdp::params::user_group,
+      mode  => '0644'
     }
  
     #taskcontroller.cfg properties conditional on security

+ 31 - 0
ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_directory_from_filepath.rb

@@ -0,0 +1,31 @@
+#
+#
+# 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.
+#
+#
+#given file absolute path, return parent directory path
+
+module Puppet::Parser::Functions
+  newfunction(:hdp_get_directory_from_filepath, :type => :rvalue) do |args|
+    dir_path = ""
+    if args.length > 0
+      dir_path = File.split(args[0])[0]
+    end
+    dir_path
+  end
+end