Skip to content

Instantly share code, notes, and snippets.

@yfeldblum
Created May 15, 2012 13:24
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 yfeldblum/8c00897605b5d772117a to your computer and use it in GitHub Desktop.
Save yfeldblum/8c00897605b5d772117a to your computer and use it in GitHub Desktop.
secret_path = Pathname(node["my-recipe"]["secret"]["path"])
if secret_path.exist?
secret = secret_path.read
else
secret = new_secret
secret_path.open{|f| f.write(secret)}
end
secret_path = Pathname(node["my-recipe"]["secret"]["path"])
if secret_path.exist?
secret = secret_path.read
else
# should never get here
raise StandardError, "secret path is missing"
end
template "/etc/my-app.conf" do
variables :secret => secret
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment