Add network.hwaddr function

This function was part of salt in the past but was removed when the
output from network.interfaces was refactored a while back. This commit
adds it back.
This commit is contained in:
Erik Johnson 2013-02-10 19:34:01 -06:00
parent 572db25c3c
commit 65eeaa9733

View File

@ -239,6 +239,17 @@ def interfaces():
return ifaces
def hwaddr(iface):
'''
Return the hardware address (a.k.a. MAC address) for a given interface
CLI Example::
salt '*' network.hwaddr eth0
'''
return interfaces().get(iface, {}).get('hwaddr', '')
def _get_net_start(ipaddr, netmask):
ipaddr_octets = ipaddr.split('.')
netmask_octets = netmask.split('.')