equal
deleted
inserted
replaced
40 Takes dhcp:* extensions as keyword arguments |
40 Takes dhcp:* extensions as keyword arguments |
41 |
41 |
42 subclass: name - generate a subclass name $ethernet for this host |
42 subclass: name - generate a subclass name $ethernet for this host |
43 """ |
43 """ |
44 |
44 |
45 if set(host.ethernet) == set([None]) : |
45 if not host.ethernet: |
46 host_fmt = "{host.name}" |
|
47 elif host.ethernet : |
|
48 host_fmt = "{host.name}-{index}" |
|
49 else : |
|
50 # nothing to be seen here |
46 # nothing to be seen here |
51 return |
47 return |
52 |
48 |
53 if host.owner : |
49 if host.owner : |
54 comment = u"Owner: {host.owner}".format(host=host) |
50 comment = u"Owner: {host.owner}".format(host=host) |
55 else: |
51 else: |
56 comment = None |
52 comment = None |
57 |
53 |
58 for index, ethernet in host.ethernet.iteritems() : |
54 for index, ethernet in host.ethernet.iteritems() : |
59 name = host_fmt.format(host=host, index=index) |
55 if index: |
|
56 name = '{host.name}-{index}'.format(host=host, index=index) |
|
57 else: |
|
58 name = '{host.name}'.format(host=host) |
|
59 |
60 items = list(dhcp_host_options(host, ethernet)) |
60 items = list(dhcp_host_options(host, ethernet)) |
61 |
61 |
62 yield pvl.dhcp.config.Block(('host', name), items, comment=comment) |
62 yield pvl.dhcp.config.Block(('host', name), items, comment=comment) |
63 |
63 |
64 if subclass: |
64 if subclass: |