def get_primary_mac_address():
    """Determines the MAC address to use for querying the AWS
    meta data service for network related queries

    :return: (str) MAC address for the eth0 interface
    :raises: AWSMetaDataError
    """
    log = logging.getLogger(mod_logger + '.get_primary_mac_address')
    log.debug('Attempting to determine the MAC address for eth0...')
    try:
        mac_address = netifaces.ifaddresses('eth0')[netifaces.AF_LINK][0]['addr']
    except Exception:
        _, ex, trace = sys.exc_info()
        msg = '{n}: Unable to determine the eth0 mac address for this system:\n{e}'.format(
            n=ex.__class__.__name__, e=str(ex))
        raise AWSMetaDataError, msg, trace
    return mac_address
def get_primary_mac_address ( ) : log = logging . getLogger ( mod_logger + '.get_primary_mac_address' ) log . debug ( 'Attempting to determine the MAC address for eth0...' ) try : mac_address = netifaces . ifaddresses ( 'eth0' ) [ netifaces . AF_LINK ] [ 0 ] [ 'addr' ] except Exception : _ , ex , trace = sys . exc_info ( ) msg = '{n}: Unable to determine the eth0 mac address for this system:\n{e}' . format ( n = ex . __class__ . __name__ , e = str ( ex ) ) raise AWSMetaDataError , msg , trace return mac_address
Determines the MAC address to use for querying the AWS
    meta data service for network related queries

    :return: (str) MAC address for the eth0 interface
    :raises: AWSMetaDataError