Module: Chef::DSL::DataQuery

Defined in:
lib/chef/dsl/data_query.rb

Instance Method Summary collapse

Instance Method Details

#secure_data_bag_item(bag, item) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/chef/dsl/data_query.rb', line 5

def secure_data_bag_item(bag, item)
  DataBag.validate_name!(bag.to_s)
  SecureDataBag::Item.validate_id!(item)
  SecureDataBag::Item.load(bag, item)
rescue Exception
  Log.error("Failed to load secure data bag item: #{bag.inspect} #{item.inspect}")
  raise
end

#secure_data_bag_item!(item, fields = []) ⇒ Object



14
15
16
17
18
# File 'lib/chef/dsl/data_query.rb', line 14

def secure_data_bag_item!(item, fields=[])
  secure = SecureDataBag::Item.from_item item
  secure.encoded_fields.concat(Array(fields))
  secure
end