# class Chef::Knife::DataBagDelete

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/data_bag_delete.rb, line 32
    def run
      if @name_args.length == 2
        delete_object(Chef::DataBagItem, @name_args[1], "data_bag_item") do
          rest.delete_rest("data/#{@name_args[0]}/#{@name_args[1]}")
        end
      elsif @name_args.length == 1
        delete_object(Chef::DataBag, @name_args[0], "data_bag") do
          rest.delete_rest("data/#{@name_args[0]}")
        end
      else
        show_usage
        ui.fatal("You must specify at least a data bag name")
        exit 1
      end
    end