class Chef::Knife::DataBagShow
Public Instance Methods
read_secret()
click to toggle source
# File lib/chef/knife/data_bag_show.rb, line 45 def read_secret if config[:secret] config[:secret] else Chef::EncryptedDataBagItem.load_secret(config[:secret_file]) end end
run()
click to toggle source
# File lib/chef/knife/data_bag_show.rb, line 61 def run display = case @name_args.length when 2 if use_encryption raw = Chef::EncryptedDataBagItem.load(@name_args[0], @name_args[1], read_secret) format_for_display(raw.to_hash) else format_for_display(Chef::DataBagItem.load(@name_args[0], @name_args[1]).raw_data) end when 1 format_list_for_display(Chef::DataBag.load(@name_args[0])) else stdout.puts opt_parser exit(1) end output(display) end
use_encryption()
click to toggle source
# File lib/chef/knife/data_bag_show.rb, line 53 def use_encryption if config[:secret] && config[:secret_file] stdout.puts "please specify only one of --secret, --secret-file" exit(1) end config[:secret] || config[:secret_file] end