Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:3209014
Created Jul 30, 2012

Role options only appear if servers are defined
[me@localhost ~]$ cat rolebug
role :test1, :color => "\033[34m"
role :test2, 'localhost', :color => "\033[34m"
server "localhost", :test1, :test2
task :date1, :roles => [:test1] do
run "date" do |channel, stream, data|
puts "options: #{channel[:server].options}, date: #{data}"
end
end
task :date2, :roles => [:test2] do
run "date" do |channel, stream, data|
puts "options: #{channel[:server].options}, date: #{data}"
end
end
[me@localhost ~]$ cap -f rolebug date1
* executing `date1'
* executing "date"
servers: ["localhost"]
[localhost] executing command
options: {}, date: Mon Jul 30 14:34:11 EDT 2012
command finished in 65ms
[me@localhost ~]$ cap -f rolebug date2
* executing `date2'
* executing "date"
servers: ["localhost"]
[localhost] executing command
options: {:color=>"\e[34m"}, date: Mon Jul 30 14:34:18 EDT 2012
command finished in 104ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment