Module: Chef::DataRegion::DataQuery

Defined in:
lib/chef/data_region.rb

Overview

DataQuery module

This module borrows its name from Chef::DSL::DataQuery, which defines the ‘data_bag_item` method. It exists for mixing in to Recipe, as occurs with Chef::DSL::DataQuery. This is the means by which `data_bag_item` is available in Chef recipes without qualification.

Instance Method Summary collapse

Instance Method Details

#data_bag_item(bag, item, secret = nil) ⇒ Chef::DataBagItem

Fetch the specified item from the specified bag

Parameters:

  • bag

    data bag name

  • item

    data bag item name

  • secret (defaults to: nil)

    encrypted data bag item secret key

Returns:

  • (Chef::DataBagItem)

    the fetched data bag item



39
40
41
42
# File 'lib/chef/data_region.rb', line 39

def data_bag_item(bag, item, secret = nil)
  loaded_item = Chef::DataBagItem.load(expand_bag_name(bag), item)
  encrypted?(loaded_item) ? decrypt(loaded_item) : loaded_item
end