Show
Ignore:
Timestamp:
05/12/10 14:10:28 (2 years ago)
Author:
Frederic Lepied <frederic.lepied@…>
Children:
36e3187115d175e2667c28737fdaccbd1fed1723
Parents:
a37e6686ba85de9cf2e143a6485dd63bceff9404
git-committer:
Frederic Lepied <frederic.lepied@…> (05/12/10 14:10:28)
Message:

allow to use IP addresses and sub-adresses instead of mac addresses

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pxe/common.py

    rfa9915f r73db309  
    8080    create_symlink(prof, name_dst) 
    8181    for m in MacAddress.objects.filter(system=system): 
    82         dst = '%s/01-%s' % (settings.PXE_ROOT, mac2filename(m.mac)) 
     82        if len(m.mac) == 12: 
     83            dst = '%s/01-%s' % (settings.PXE_ROOT, mac2filename(m.mac)) 
     84        else: 
     85            dst = '%s/%s' % (settings.PXE_ROOT, m.mac) 
    8386        create_symlink(system.name, dst) 
    8487         
     
    8992    log.save() 
    9093 
     94def simplify_ip(ip): 
     95    '''Rertun a string containing the hexadecimal representation of an ipv4 address or a sub-part.''' 
     96    l = ip.split('.') 
     97    s = '' 
     98    for e in l: 
     99        s = s + '%02x' % int(e) 
     100    return s 
     101 
    91102# common.py ends here