# File lib/facter/util/ip.rb, line 117 117: def self.get_bonding_master(interface) 118: if Facter.value(:kernel) != 'Linux' 119: return nil 120: end 121: # We need ip instead of ifconfig because it will show us 122: # the bonding master device. 123: if not FileTest.executable?("/sbin/ip") 124: return nil 125: end 126: # A bonding interface can never be an alias interface. Alias 127: # interfaces do have a colon in their name and the ip link show 128: # command throws an error message when we pass it an alias 129: # interface. 130: if interface =~ /:/ 131: return nil 132: end 133: regex = /SLAVE[,>].* (bond[0-9]+)/ 134: ethbond = regex.match(%x{/sbin/ip link show #{interface}}) 135: if ethbond 136: device = ethbond[1] 137: else 138: device = nil 139: end 140: device 141: end