lib/filbunke/client.rb in filbunke-1.8.4 vs lib/filbunke/client.rb in filbunke-1.9.0

- old
+ new

@@ -139,11 +139,11 @@ def update_file!(file, local_file_path) if file.url =~ /^http:\/\// update_http_file!(file, local_file_path) - elsif file.url =~ /^hdfs:\/\// + elsif (file.url =~ /^hdfs:\/\//) || (file.url =~ /^hftp:\/\//) success = update_hdfs_file!(file, local_file_path) run_callbacks(file, local_file_path) if success else raise "Unsupported protocol for file: #{file.inspect}" end @@ -236,10 +236,15 @@ def update_hdfs_file!(file, local_file_path) begin ::FileUtils.mkdir_p(::File.dirname(local_file_path)) ::FileUtils.rm_f("#{local_file_path}.tmp") - hdfs_cmd = "#{@repository.hadoop_binary} fs -copyToLocal #{file.url} #{local_file_path}.tmp" + url = file.url + if (url =~ /^hdfs:\/\//) + url.gsub!(/hdfs:\/\//, "hftp://") + url.gsub!(/:8020/, "") + end + hdfs_cmd = "#{@repository.hadoop_binary} fs -copyToLocal #{url} #{local_file_path}.tmp" @logger.log "Trying to update #{local_file_path} with '#{hdfs_cmd}'" pid, stdin, stdout, stderr = Open4::popen4 hdfs_cmd ignored, status = Process::waitpid2 pid