scripts/chef/hdfsdir_provider.rb
#
# Method automatically called by Chef during the client execution phase
# Can be used to initialize variables and also verify the current state
#
Method automatically called by Chef during the client execution phase
Can be used to initialize variables and also verify the current state
Method automatically called by Chef during the client execution phase Can be used to initialize variables and also verify the current state
def load_current_resource
   Not taking the typical approach of creating a current_resource will make
   this LWRP usable with any cookbook without changes. We are creating 
   instance variables for each attribute which would be available in the
   @current_resource object if we had created one.
  -- @current_resource = Chef::Resource::BcpcHdfsdir.new(new_resource.name)
  -- new_resource.user == nil ? @current_resource.user = ENV['USER'] : @current_resource.user = new_resource.user
  new_resource.user == nil ? @user = ENV['USER'] : @user = new_resource.user
  nnaddress = new_resource.namenode
  nnport = new_resource.nnport
  @client = WebHDFS::Client.new(nnaddress,nnport,@user)
  if (!validnn?())
    raise RuntimeError, "Invalid namenode provided or HDFS not available"
  end
  @omode = new_resource.mode
  new_resource.mode == nil ? @mode = "0750" : @mode = new_resource.mode
  @path = new_resource.path
  @tpath = new_resource.tpath
  @tgroup = new_resource.tgroup
  @tuser = new_resource.tuser
end
def load_current_resource new_resource . user == nil ? @user = ENV [ 'USER' ] : @user = new_resource . user nnaddress = new_resource . namenode nnport = new_resource . nnport @client = WebHDFS :: Client . new ( nnaddress , nnport , @user ) if ( ! validnn? ( ) ) raise RuntimeError , "Invalid namenode provided or HDFS not available" end @omode = new_resource . mode new_resource . mode == nil ? @mode = "0750" : @mode = new_resource . mode @path = new_resource . path @tpath = new_resource . tpath @tgroup = new_resource . tgroup @tuser = new_resource . tuser end
Method automatically called by Chef during the client execution phase
Can be used to initialize variables and also verify the current state
Method automatically called by Chef during the client execution phase Can be used to initialize variables and also verify the current state
# # Not taking the typical approach of creating a current_resource will make # this LWRP usable with any cookbook without changes. We are creating  # instance variables for each attribute which would be available in the # @current_resource object if we had created one. # #-- @current_resource = Chef::Resource::BcpcHdfsdir.new(new_resource.name) #-- new_resource.user == nil ? @current_resource.user = ENV['USER'] : @current_resource.user = new_resource.user