# class Chef::Knife::DataBagFromFile

### Public Instance Methods

loader() click to toggle source

    # File lib/chef/knife/data_bag_from_file.rb, line 69
    def loader
      @loader ||= Knife::Core::ObjectLoader.new(DataBagItem, ui)
    end

read_secret() click to toggle source

    # File lib/chef/knife/data_bag_from_file.rb, line 53
    def read_secret
      if config[:secret]
        config[:secret]
      else
        Chef::EncryptedDataBagItem.load_secret(config[:secret_file])
      end
    end

run() click to toggle source

    # File lib/chef/knife/data_bag_from_file.rb, line 73
    def run
      if config[:all] == true
        load_all_data_bags(@name_args)
      else
        if @name_args.size < 2
          ui.msg(opt_parser)
          exit(1)
        end
        @data_bag = @name_args.shift
        load_data_bag_items(@data_bag, @name_args)
      end
    end

use_encryption() click to toggle source

    # File lib/chef/knife/data_bag_from_file.rb, line 61
    def use_encryption
      if config[:secret] && config[:secret_file]
        ui.fatal("please specify only one of --secret, --secret-file")
        exit(1)
      end
      config[:secret] || config[:secret_file]
    end