Class: Chef::Knife::SecureBagOpen

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

Instance Method Summary collapse

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chef/knife/secure_bag_open.rb', line 16

def run
  unless ::File.exist?(@name_args[0])
    ui.fatal('File not found.')
    show_usage
    exit 1
  end

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

  data = File.read(@name_args[0])
  data = JSON.parse(data)
  item = create_item('local', @name_args[0], data, )

  display_data = item.to_hash(metadata: true)
  display_data = format_for_display(display_data)

  output(display_data)
end