lib/fezzik/host_task.rb in fezzik-0.8.1 vs lib/fezzik/host_task.rb in fezzik-0.8.2

- old
+ new

@@ -1,13 +1,14 @@ module Fezzik class HostTask < Rake::Task - attr_accessor :roles + attr_accessor :roles, :weave_options def initialize(task_name, app) super - @roles = [] @host_actions = [] + @roles = [] + @weave_options = {} end def enhance(deps = nil, &block) @host_actions << block if block_given? super(deps) @@ -19,11 +20,11 @@ if @roles.empty? hosts = Fezzik.get(:domain).map { |domain| "#{Fezzik.get(:user)}@#{domain}" } @@connection_pool ||= Weave::ConnectionPool.new @host_actions.each do |action| begin - @@connection_pool.execute_with(hosts, :args => [self, args], &action) + @@connection_pool.execute_with(hosts, @weave_options.merge(:args => [self, args]), &action) rescue Weave::Error => e STDERR.puts "Error running command in HostTask '#{@name}':" abort e.message end end @@ -33,10 +34,11 @@ hosts = Fezzik.get(:domain).map { |domain| "#{Fezzik.get(:user)}@#{domain}" } @@role_connection_pools ||= {} @@role_connection_pools[role] ||= Weave::ConnectionPool.new @host_actions.each do |action| begin - @@role_connection_pools[role].execute_with(hosts, :args => [self, args], &action) + @@role_connection_pools[role].execute_with(hosts, @weave_options.merge(:args => [self, args]), + &action) rescue Weave::Error => e STDERR.puts "Error running command in HostTask '#{@name}' with role '#{role}':" abort e.message end end