Sha256: 4bc53e76bbed5e44267b840b5b9c6491f6b5d4b55989da7cfdc98a34162c3144

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

#
# Author:: Christo De Lange <opscode@dldinternet.com>
# Monkey patch for Chef::Knife::DataBagFromFile
#
require 'chef/knife/data_bag_from_file'

class ::Chef::Knife::DataBagFromFile

  # --------------------------------------------------------------------------------------------------------------------
  # Create a new instance of the current class configured for the given
  # arguments and options
  def initialize(argv=[])
    super(argv)
    @rsrctype = 'databag'
    @location = 'data_bags'
  end

  # DLDInternet monkey patch of original
  def load_data_bag_items(data_bag, items = nil)
    items ||= find_all_data_bag_items(data_bag)
    item_paths = normalize_item_paths(items)
    item_paths.each do |item_path|
      item = loader.load_from("#{data_bags_path}", data_bag, item_path)
      item = if use_encryption
               secret = read_secret
               Chef::EncryptedDataBagItem.encrypt_data_bag_item(item, secret)
             else
               item
             end
      dbag = Chef::DataBagItem.new
      dbag.data_bag(data_bag)
      dbag.raw_data = item
      dbag.save
      # BEGIN changes DLDInternet
      ui.info("Updated data_bag_item[#{dbag.data_bag}::#{dbag.id}]")
      # END changes DLDInternet
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knife-chop-0.9.0 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.8.3 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.8.2 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.8.0 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.7.8 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.7.2 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.7.1 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.7.0 lib/chef/knife/chop/data_bag_from_file.rb
knife-chop-0.6.7 lib/chef/knife/chop/data_bag_from_file.rb