module KnifeUploader::DataBagUtils

Public Class Methods

decrypted_attributes(data_bag_item) click to toggle source
# 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