diff options
author | Paul Nasrat <pnasrat@googlemail.com> | 2008-07-17 13:31:18 +0100 |
---|---|---|
committer | Paul Nasrat <pnasrat@googlemail.com> | 2008-07-17 13:31:18 +0100 |
commit | dc7363e837ecf95ff2c4a17ddd8c3065e414cf37 (patch) | |
tree | 04ec662153dad34a913848ed39d0eaf1e8e7a6fd | |
parent | 0df872ba1df2646bcfa111f004a530a805b02c74 (diff) | |
download | facter-dc7363e837ecf95ff2c4a17ddd8c3065e414cf37.tar.gz facter-dc7363e837ecf95ff2c4a17ddd8c3065e414cf37.tar.xz facter-dc7363e837ecf95ff2c4a17ddd8c3065e414cf37.zip |
Set macaddress on windows platform
-rw-r--r-- | lib/facter/macaddress.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index 30d4b59..98e38b8 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -63,3 +63,17 @@ Facter.add(:macaddress) do ether[0] end end + +Facter.add(:macaddress) do + confine :kernel => %w(windows) + setcode do + ether = [] + output = %x{ipconfig /all} + output.split(/\r\n/).each do |str| + if str =~ /.*Physical Address.*: (\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2}-\w{1,2})/ + ether.push($1.gsub(/-/, ":")) + end + end + ether[0] + end +end |