Class: Chef::Knife::SecureBagFromFile
- Inherits:
-
Knife::DataBagFromFile
- Object
- Knife::DataBagFromFile
- Chef::Knife::SecureBagFromFile
show all
- Includes:
- SecureBagBase
- Defined in:
- lib/chef/knife/secure_bag_from_file.rb
Instance Method Summary
collapse
#data_for_create, #data_for_edit, #data_for_save, #encoded_fields, included, #read_secret, #require_secret, #secret_file, #use_encryption
Instance Method Details
#load_data_bag_hash(hash) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/chef/knife/secure_bag_from_file.rb', line 26
def load_data_bag_hash(hash)
@raw_data = hash
item = SecureDataBag::Item.from_hash(hash, secret:read_secret)
item.to_hash
end
|
#load_data_bag_items(data_bag, items = nil) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/chef/knife/secure_bag_from_file.rb', line 33
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 = load_data_bag_hash(item)
dbag = SecureDataBag::Item.new(secret:read_secret)
dbag.encoded_fields encoded_fields
dbag.raw_data = item
dbag.data_bag(data_bag)
dbag.save
ui.info("Updated data_bag_item[#{dbag.data_bag}::#{dbag.id}]")
end
end
|