summaryrefslogtreecommitdiff
path: root/lib/facter/interfaces.rb
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-10-31 15:16:31 +0100
committermh <mh@immerda.ch>2009-10-31 15:16:31 +0100
commit11c66b121dbd6a9ce1cb77067d2844839b9c609f (patch)
tree394920e4918b110fe4dc9214c828f826a55d9761 /lib/facter/interfaces.rb
parent23b3b3caca4b00f900ed323e7186453eb23ff6f6 (diff)
move plugin directory to fit new 0.25 style
Diffstat (limited to 'lib/facter/interfaces.rb')
-rwxr-xr-xlib/facter/interfaces.rb13
1 files changed, 13 insertions, 0 deletions
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