On Wednesday, July 10, 2013 at 14:25, Noah Kantrowitz wrote:
On Jul 10, 2013, at 10:19 AM, Cassiano Leal wrote:Hi,How do I pass parameters (preferably via attributes) to the database block in the application_ruby cookbook?What I want to do is something like:application “my_app” do...rails do...database dousername node[:my_app][:db_user]password node[:my_app][:db_password]endendendIt looks like the database block does not have access to the node object.I have the application resource inside a definition, so I also tried to pass parameters to it, like params[:db_user], but that does not work either.How do I set those database parameters dynamically?Its an issue with Ruby's method lookup order. Outside of that block (I usually just do it at the top of the file) do "blah = node[:my_app]" and then in the block you can do "username blah[:db_user]" and whatnot since then it knows that blah is a variable and not a method call :-( method_missing, got to love it!--Noah
Archive powered by MHonArc 2.6.16.