Class: Chef::Knife::SecureBagShow

Inherits:
Knife::DataBagShow
  • Object
show all
Includes:
SecureDataBag::BaseMixin, SecureDataBag::DefaultsMixin, SecureDataBag::ExportMixin, SecureDataBag::SecretsMixin
Defined in:
lib/chef/knife/secure_bag_show.rb

Instance Method Summary collapse

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/chef/knife/secure_bag_show.rb', line 18

def run
  case @name_args.length
  when 2
    run_show
  when 1
    run_list
  else
    stdout.puts opt_parser
    exit(1)
  end
end

#run_listObject



44
45
46
47
48
# File 'lib/chef/knife/secure_bag_show.rb', line 44

def run_list
  data = Chef::DataBag.load(@name_args[0])
  data = format_list_for_display(data)
  output(data)
end

#run_showObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/chef/knife/secure_bag_show.rb', line 30

def run_show
  config_defaults_for_data_bag!(@name_args[0])

   = .dup
  [:encryption_format] ||= 'plain'

  item = load_item(@name_args[0], @name_args[1], )
  data = item.to_hash(metadata: true)
  data = format_for_display(data)

  export!(@name_args[0], @name_args[1], item) if should_export?
  output(data)
end