訪問serverDefinition選項我定義我的服務器設置是這樣的:Capistrano的如何在代碼
task :test do
role(:frontend) {[server1,server2,server3, {:user=> "frontend-user", :options => {:log_location=>"HOW DO I READ THIS??"}}]}
role(:backend) {...}
role(:db) {...}
role(:mq) {...}
end
task :staging do
role(:frontend) {[server1,server2,server3, {:user=> "frontend-user", :options => {:log_location=>"HOW DO I READ THIS??"}}]}
role(:backend) {...}
role(:db) {...}
role(:mq) {...}
end
task :prod do
role(:frontend) {[server1,server2,server3, {:user=> "frontend-user", :options => {:log_location=>"HOW DO I READ THIS??"}}]}
role(:backend) {...}
role(:db) {...}
role(:mq) {...}
end
這是擁抱傳統enterpricey系統的所有複雜性。
現在,從一項任務,我想讀log_location
。
任務例如:
namespace :log do
desc "list all log files"
task :list do
run %(ls -1 #{log_location}/*/*.log)
end
end
的問題是,可變log_location
是未定義的。
/.rvm/gems/ruby-2.0.0-p0/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:193:in
method_missing': undefined local variable or method
log_location」 爲 #( NameError)
- 如何訪問該變量?
- 是否有更智能/更簡單的方法來設置這個自定義變量?
http://stackoverflow.com/問題/ 2339987 /你如何溝通耙 - 任務可能會有所幫助?或者這太粗糙了? – olleolleolle 2013-03-26 08:49:14