lib/ovsimager/ipnetns.rb in ovsimager-0.0.3 vs lib/ovsimager/ipnetns.rb in ovsimager-0.0.4
- old
+ new
@@ -15,10 +15,14 @@
merge_link_type(@ifaces[ns], links)
}
find_veth_pair
end
+ def ns()
+ @ns
+ end
+
def to_hash()
@ifaces
end
def ifaces_hash()
@@ -34,11 +38,12 @@
end
private
def parse(out, args)
out.split(/\n(?=[^ \s])/).map do |iface|
- if iface.match(/^(\d+):\s+(\S+?)(?:@\S+)?:+/)
+ if iface.match(/^(\d+):\s+(\S+?)(?:@(\S+))?:+/)
params = {:id => $1, :name => $2}
+ params[:peer] = $3 if $3 && $3 != 'NONE' && $3[0,2] != 'if'
yield params, iface, args
else
STDERR.puts "IPNetNS: parse error: #{iface}"
{}
end