Created
September 1, 2016 11:48
-
-
Save kjetilho/915d4130e91525be3a5642754094b4c2 to your computer and use it in GitHub Desktop.
phys_interfaces fact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# phys_interfaces returns network interfaces associated with a physical device | |
# as a comma separated list. | |
# | |
# Written by kjetil.homme@redpill-linpro.com 2016 | |
# Released into the public domain | |
require 'facter' | |
Facter.add("phys_interfaces") do | |
confine :kernel => :linux | |
setcode do | |
Dir.glob('/sys/class/net/*/device').map { |p| | |
p.split('/')[4] | |
}.join(',') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment