lib/ovsimager/ipnetns.rb in ovsimager-0.0.5 vs lib/ovsimager/ipnetns.rb in ovsimager-0.0.6
- old
+ new
@@ -23,11 +23,15 @@
def to_hash()
@ifaces
end
+ def ifname_ns(iface)
+ iface[:name] + (iface[:ns] == :root ? "" : ":" + iface[:ns].to_s)
+ end
+
def ifaces_hash()
- @ifaces.inject({}) {|h, (ns, v)| v.each {|i| h[i[:name]] = i}; h}
+ @ifaces.inject({}) {|h, (ns, v)| v.each {|i| h[ifname_ns(i)] = i}; h}
end
def ifaces_ary()
@ifaces.inject([]) {|a, (ns, v)| v.each {|i| a[i[:id].to_i] = i}; a}
end