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
#encode_fields_to_array, #encoded_fields_for, included, #require_secret, #use_encryption, #use_secure_databag
Instance Method Details
#load_data_bag_hash(hash) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/chef/knife/secure_bag_from_file.rb', line 27
def load_data_bag_hash(hash)
@raw_data = hash
if use_encryption
item = Chef::EncryptedDataBagItem.
encrypt_data_bag_item(output, read_secret)
end
item = SecureDataBag::Item.from_hash(hash, read_secret)
item.encode_fields encoded_fields_for(item)
item.to_hash
end
|
#load_data_bag_items(data_bag, items = nil) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/chef/knife/secure_bag_from_file.rb', line 40
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 = Chef::DataBagItem.new
dbag.data_bag(data_bag)
dbag.raw_data = item
dbag.save
ui.info("Updated data_bag_item[#{dbag.data_bag}::#{dbag.id}]")
end
end
|