Created
December 23, 2015 09:15
-
-
Save lukebigum/029874b48048010c841b to your computer and use it in GitHub Desktop.
Facter Fact for PTP Hardware Clocks
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
#Look for networking interfaces that have ptp devices | |
module PhcFact | |
def self.add_facts | |
phc = {} | |
Dir.glob("/sys/class/net/*/device/ptp/*") do |dir| | |
m = /\/sys\/class\/net\/(\S+)\/device\/ptp\/(\S+)/.match(dir) | |
phc[m[1]] = m[2] | |
end | |
Facter.add("phc") do | |
setcode do | |
phc | |
end | |
end | |
end | |
end | |
PhcFact.add_facts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment