Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: abd8139e16
Fetching contributors…

Cannot retrieve contributors at this time

executable file 33 lines (26 sloc) 0.873 kb
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "yajl"
result = {}
ARGF.each do |line|
if /DEBUG -- : RECEIVED: director./ =~ line
json = line[line.index("{")..-1]
message = Yajl::Parser.parse(json)
if message["value"] && message["value"].kind_of?(Hash) && message["value"]["job_state"]
spec = message["value"]
result[[spec["job"]["name"], spec["index"]]] = "#{spec["networks"].collect{ |name, network| network["ip"] + ((network["default"] && network["default"].include?("gateway")) ? "(*)" : "")}.join(", ")}" if spec["configuration_hash"]
end
end
end
result.sort{ |a, b|
name_a = a[0][0]
name_b = b[0][0]
result = name_a <=> name_b
if result == 0
index_a = a[0][1]
index_b = b[0][1]
result = index_a <=> index_b
end
result
}.each { |key, value| puts "#{key[0]}/#{key[1]} => #{value}" }
Jump to Line
Something went wrong with that request. Please try again.