From 11c66b121dbd6a9ce1cb77067d2844839b9c609f Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 31 Oct 2009 15:16:31 +0100 Subject: move plugin directory to fit new 0.25 style --- lib/facter/interfaces.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 lib/facter/interfaces.rb (limited to 'lib/facter/interfaces.rb') diff --git a/lib/facter/interfaces.rb b/lib/facter/interfaces.rb new file mode 100755 index 0000000..a498d64 --- /dev/null +++ b/lib/facter/interfaces.rb @@ -0,0 +1,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 -- cgit v1.2.3