Sha256: d5f52d85f5dec6fc353ba172848b869f51b74613899eed65dc6bb902e4fe68b2

Contents?: true

Size: 745 Bytes

Versions: 15

Compression:

Stored size: 745 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'

require "rubygems"
require "mandy"

HadoopConfiguration.check_home_and_version

exec('mandy-exists -h') unless ARGV.size >= 2


options = OpenStruct.new

OptionParser.new do |opts|
  opts.banner = "USAGE: mandy-exists hdfs_file_path [options]"

  opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
    options.config = config
  end
  
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end.parse!

source = ARGV[0]
config = options.config || 'cluster.xml'

exists = system("$HADOOP_HOME/bin/hadoop fs -conf #{config} -test -e #{source}")

puts(exists ? "#{source} exists" : "#{source} not found")
exit(exists ? 0 : -1)

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mandy-0.5.28 bin/mandy-exists
mandy-0.5.27 bin/mandy-exists
mandy-0.5.26 bin/mandy-exists
mandy-0.5.25 bin/mandy-exists
mandy-0.5.24 bin/mandy-exists
mandy-0.5.23 bin/mandy-exists
mandy-0.5.22 bin/mandy-exists
mandy-0.5.21 bin/mandy-exists
mandy-0.5.20 bin/mandy-exists
mandy-0.5.19 bin/mandy-exists
mandy-0.5.17 bin/mandy-exists
mandy-0.5.14 bin/mandy-exists
mandy-0.5.13 bin/mandy-exists
mandy-0.5.11 bin/mandy-exists
mandy-0.5.10 bin/mandy-exists