Class: Phase::SSH::BastionCoordinator
- Inherits:
-
Object
- Object
- Phase::SSH::BastionCoordinator
- Defined in:
- lib/phase/kit/ssh/bastion_coordinator.rb
Instance Method Summary collapse
- #each(options = {}, &block) ⇒ Object
-
#initialize(bastion, destination_hosts) ⇒ BastionCoordinator
constructor
A new instance of BastionCoordinator.
Constructor Details
#initialize(bastion, destination_hosts) ⇒ BastionCoordinator
Returns a new instance of BastionCoordinator.
5 6 7 8 |
# File 'lib/phase/kit/ssh/bastion_coordinator.rb', line 5 def initialize(bastion, destination_hosts) @bastion = bastion @destination_hosts = destination_hosts end |
Instance Method Details
#each(options = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/phase/kit/ssh/bastion_coordinator.rb', line 10 def each( = {}, &block) if hosts queue = Queue.new @destination_hosts.each {|host| queue << hosts } = .merge() [:address_queue] = queue case [:in] when :parallel then ::Phase::SSH::Runners::Parallel when :sequence then ::Phase::SSH::Runners::Sequential when :groups then ::Phase::SSH::Runners::Group else raise RuntimeError, "Don't know how to handle run style #{[:in].inspect}" end.new([@bastion] * @destination_hosts.count, , &block).execute else Runners::Null.new(hosts, , &block).execute end end |