Module: Chef::DSL::DataQuery

Defined in:
lib/secure_data_bag.rb

Instance Method Summary collapse

Instance Method Details

#secure_data_bag_item(bag, item) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/secure_data_bag.rb', line 13

def secure_data_bag_item(bag, item)
  DataBag.validate_name!(bag.to_s)
  SecureDataBagItem.validate_id!(item)
  SecureDataBagItem.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



22
23
24
25
26
# File 'lib/secure_data_bag.rb', line 22

def secure_data_bag_item!(item, fields=[])
  secure = SecureDataBag::SecureDataBagItem.from_item item
  secure.encode_fields secure.encode_fields + fields
  secure
end