Sha256: f19cbdbaf80f83efba2a973213106ff7e423ef14bbb75dd2b29e707a9d2f255c
Contents?: true
Size: 1.23 KB
Versions: 18
Compression:
Stored size: 1.23 KB
Contents
module Phase module SSH class BastionCoordinator def initialize(bastion, destination_hosts) @bastion = bastion @destination_hosts = destination_hosts end def each(options = {}, &block) if hosts queue = Queue.new @destination_hosts.each {|host| queue << hosts } options = default_options.merge(options) options[:address_queue] = queue case options[: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 #{options[:in].inspect}" end.new([@bastion] * @destination_hosts.count, options, &block).execute else Runners::Null.new(hosts, options, &block).execute end end # def run!(options = {}, &block) # backend = Backend.new(@bastion, options) # # results = @destination_hosts.each do |host| # backend.run do # on_remote_host(ip) { instance_exec(&block) } # end # end # # results.flatten # end end end end
Version data entries
18 entries across 18 versions & 1 rubygems