Skip to content

Instantly share code, notes, and snippets.

@josqu4red
Created November 14, 2014 09:14
Show Gist options
  • Save josqu4red/274bc9521d0173f0cae3 to your computer and use it in GitHub Desktop.
Save josqu4red/274bc9521d0173f0cae3 to your computer and use it in GitHub Desktop.
Convenient wrapper for Chef encrypted data bags
class Chef
module DSL
module DataQuery
def encrypted_data_bag_item(bag, item)
secret = Chef::EncryptedDataBagItem.load_secret(File.join(node["chef"]["config_dir"], "encrypted_databags_secrets", bag, item))
Chef::EncryptedDataBagItem.load(bag, item, secret)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment