Skip to content

Instantly share code, notes, and snippets.

@brettcave
Created October 21, 2013 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettcave/7082764 to your computer and use it in GitHub Desktop.
Save brettcave/7082764 to your computer and use it in GitHub Desktop.
Write secret key file and then reference it
get_file = ruby_block "get_file" do
block do
conn = Some::Remote.new("param")
remoteFile = conn.get("/path/to/file")
localFile = File.open("/tmp/test_secret_key",'w')
localFile.write(remoteFile.contents)
end
not_if { ::File.exists?("/tmp/test_secret_key") }
action :nothing
end
get_file.run_action(:create)
secret_key = Chef::EncryptedDataBagItem.load_secret("/tmp/test_secret_key")
# Fails: invalid zero length secret in "/tmp/test_secret_key"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment