Class: Chef::Knife::SecureBagShow
- Inherits:
-
Knife::DataBagShow
- Object
- Knife::DataBagShow
- Chef::Knife::SecureBagShow
show all
- Includes:
- SecureBagBase
- Defined in:
- lib/chef/knife/secure_bag_show.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_item(bag, item_name) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/chef/knife/secure_bag_show.rb', line 19
def load_item(bag, item_name)
item = SecureDataBag::Item.load(
bag, item_name,
key: read_secret,
fields: encoded_fields
)
item.encoded_fields(encoded_fields)
data = item.to_hash(encoded:config[:encoded])
data = data_for_edit(data) unless config[:encoded]
data
end
|
#run ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/chef/knife/secure_bag_show.rb', line 32
def run
display = case @name_args.length
when 2
item = load_item(@name_args[0], @name_args[1])
display = format_for_display(item)
when 1
format_list_for_display(Chef::DataBag.load(@name_args[0]))
else
stdout.puts opt_parser
exit(1)
end
output(display)
end
|