Module: Facter::Util::Macaddress::Darwin
- Defined in:
- lib/facter/util/macaddress.rb
Class Method Summary collapse
Class Method Details
.default_interface ⇒ Object
19 20 21 |
# File 'lib/facter/util/macaddress.rb', line 19 def self.default_interface `#{netstat_command} | /usr/bin/awk '/^default/{print $6;exit}'`.chomp end |
.macaddress ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/facter/util/macaddress.rb', line 11 def self.macaddress iface = default_interface Facter.warn "Could not find a default route. Using first non-loopback interface" if iface.empty? macaddress = `#{ifconfig_command} #{iface} | /usr/bin/awk '/ether/{print $2;exit}'`.chomp macaddress.empty? ? nil : macaddress end |