Module: KnifeUploader::DataBagUtils

Defined in:
lib/chef/knife/uploader_data_bag.rb

Class Method Summary collapse

Class Method Details

.decrypted_attributes(data_bag_item) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/chef/knife/uploader_data_bag.rb', line 22

def decrypted_attributes(data_bag_item)
  begin
    [
      Hash[data_bag_item.attributes.map do
        |key, value| [key, key == "id" ? value : data_bag_item.decrypt_value(value)]
      end],
      true  # decryption successful
    ]
  rescue OpenSSL::Cipher::CipherError, NoMethodError, NotImplementedError, ArgumentError => ex
    [data_bag_item.attributes.clone, false]
  end
end