Class: CFTools::Tunnel::MultiLineStream

Inherits:
Object
  • Object
show all
Includes:
Interact::Pretty
Defined in:
lib/tools-cf-plugin/tunnel/multi_line_stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(director, deployment, user, host) ⇒ MultiLineStream

Returns a new instance of MultiLineStream.



11
12
13
14
15
16
# File 'lib/tools-cf-plugin/tunnel/multi_line_stream.rb', line 11

def initialize(director, deployment, user, host)
  @director = director
  @deployment = deployment
  @gateway_user = user
  @gateway_host = host
end

Instance Method Details

#stream(locations) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tools-cf-plugin/tunnel/multi_line_stream.rb', line 18

def stream(locations)
  entries = entry_queue

  locations.each do |(name, index), locs|
    Thread.new do
      begin
        stream_location(name, index, locs, entries)
      rescue => e
        entries << LogEntry.new(
          "#{name}/#{index}",
          c("failed: #{e.class}: #{e}", :error),
          :stdout)

        retry
      end
    end
  end

  while entry = entries.pop
    yield entry
  end
end