Class: Chef::Knife::HadoopHdfsCreate

Inherits:
Chef::Knife show all
Includes:
HadoopBase
Defined in:
lib/chef/knife/hadoop_hdfs_create.rb

Instance Method Summary collapse

Methods included from HadoopBase

#db_connection, #hdfs_connection, included, #locate_config_value, #msg_pair

Instance Method Details

#runObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/chef/knife/hadoop_hdfs_create.rb', line 77

def run
  $stdout.sync = true

  type = "#{Chef::Config[:knife][:type]}".downcase
  case type
  when 'dir'
    hdfs_connection.mkdir("#{Chef::Config[:knife][:path]}", :permission => "#{Chef::Config[:knife][:permission]}")
  when 'file'
    ; debugger
    hdfs_connection.create("#{Chef::Config[:knife][:path]}", "#{Chef::Config[:knife][:data]}",
                           :overwrite => "#{Chef::Config[:knife][:overwrite]}", :blocksize => "#{Chef::Config[:knife][:blocksize]}",
                           :replication => "#{Chef::Config[:knife][:replication]}", :permission => "#{Chef::Config[:knife][:permission]}"
                           )
  else
    ui.error ("Incorrect options. Please use --help to list options.")
  end
end