我一直试图在厨师文档和谷歌中找到这个问题的答案,但我一直没有想出任何东西。我(还)不是一个红宝石人,所以这个问题的答案可能源于我用“刚刚足够的红宝石给厨师”来解决这个问题。这就是我想要做的:在我的deploy
资源中,在before_migrate
属性中,我想在我当前的配方中执行一个资源。我目前正在做的只是将资源填充到块本身中,但我知道必须有更好的方法来做到这一点。
before_migrate do
template "#{app_root}/#{applet_name}/local_settings.py" do
source "local_settings.py.erb"
owner app_config['user']
group app_config['group']
variables(
:database_name => app_config['postgresql']['database_name'],
:user => app_config['postgresql']['user'],
:password => app_config['postgresql']['password']
)
action :create
end
end
我的目标是
before_migrate do
"template #{app_root}/#{applet_name}/local_settings.py".execute
end
所以我可以重用那个模板代码。谢谢!