pvl/hosts/dhcp.py
changeset 689 c258e3ff6d32
parent 669 83e9bff09a0b
child 697 3c3ac207ce3f
equal deleted inserted replaced
688:dfc5fcb6a06c 689:c258e3ff6d32
    13     yield 'hardware', 'ethernet', ethernet
    13     yield 'hardware', 'ethernet', ethernet
    14 
    14 
    15     if host.ip:
    15     if host.ip:
    16         yield 'fixed-address', str(host.ip)
    16         yield 'fixed-address', str(host.ip)
    17       
    17       
    18     if not host.boot:
    18     for bootopt in ('next-server', 'filename'):
    19         next_server = filename = None
    19         if bootopt in host.boot:
    20     elif host.boot.startswith('/'):
    20             yield bootopt, host.boot[bootopt]
    21         next_server = None
       
    22         filename = host.boot[1:]
       
    23     elif host.boot.endswith(':'):
       
    24         next_server = host.boot[:-1]
       
    25         filename = None
       
    26     elif ':' in host.boot :
       
    27         next_server, filename = host.boot.split(':', 1)
       
    28     else :
       
    29         raise HostError(host, "invalid boot={host.boot}".format(host=host))
       
    30 
       
    31     if next_server:
       
    32         yield 'next-server', next_server
       
    33     
       
    34     if filename:
       
    35         yield 'filename', filename
       
    36 
    21 
    37 def dhcp_host (host):
    22 def dhcp_host (host):
    38     """
    23     """
    39         Yield pvl.dhcp.config.Block's
    24         Yield pvl.dhcp.config.Block's
    40     """
    25     """