[chef] When using application & application_php cookbooks, how can I access release_path & db host?


Chronological Thread 
  • From: Michael Johnston < >
  • To:
  • Subject: [chef] When using application & application_php cookbooks, how can I access release_path & db host?
  • Date: Tue, 24 Jul 2012 21:10:34 -0700

Say I have the following application:

application "hello_world"
        path "/srv/hello_world"
        repository "..."
        php do
                database_master_role "helloworld_db_master" 
        end
end


and I want to add a template that references the release_path & the db host. 
How can I refer to the host that the php resource calculates using 
find_database_server? How can I refer to the release_path that is constructed 
by the underlying deploy resource?


I did manage to get the host like this:

db_host = nil

application "hello_world"
        path "/srv/hello_world"
        php do
                db_host = find_database_server("kiwi_db_master") 
                database_master_role "helloworld_db_master" 
        end
end

template "/tmp/test" do
        variables(
                :host => db_host
        )
end


but I'm not sure if that is a good way.

the application resource defines a release_path method, but I could not 
figure out how to access it.


On a related note, what is the best way to share values between resources? 
with local variables as above? 


Cheerio,

Michael Johnston







  • [chef] When using application & application_php cookbooks, how can I access release_path & db host?, Michael Johnston, 07/24/2012

Archive powered by MHonArc 2.6.16.

§