summaryrefslogtreecommitdiff
path: root/plugins/facter/interfaces.rb
blob: a498d645b7162512e93b410c4e6db5dcbef3bdee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# return the set of active interfaces as an array
Facter.add("interfaces") do
	setcode do
		`ip -o link show`.split(/\n/).collect do |line|
			value = nil
			matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/)
			if !matches.nil?
				value = matches[1]
			end
			value
		end.compact.sort.join(" ")
	end
end