# HG changeset patch # User Tero Marttila # Date 1425728699 -7200 # Node ID 5e2c1b78047d14de072e102cfd5d4ec79ddca902 # Parent 2073e2e2089585596e732e8a8c692fbe92db2505 pvl.hosts.dhcp: fix mixed ethernet instance/None naming to be per-dhcp-host diff -r 2073e2e20895 -r 5e2c1b78047d pvl/hosts/dhcp.py --- a/pvl/hosts/dhcp.py Sat Mar 07 13:41:18 2015 +0200 +++ b/pvl/hosts/dhcp.py Sat Mar 07 13:44:59 2015 +0200 @@ -42,11 +42,7 @@ subclass: name - generate a subclass name $ethernet for this host """ - if set(host.ethernet) == set([None]) : - host_fmt = "{host.name}" - elif host.ethernet : - host_fmt = "{host.name}-{index}" - else : + if not host.ethernet: # nothing to be seen here return @@ -56,7 +52,11 @@ comment = None for index, ethernet in host.ethernet.iteritems() : - name = host_fmt.format(host=host, index=index) + if index: + name = '{host.name}-{index}'.format(host=host, index=index) + else: + name = '{host.name}'.format(host=host) + items = list(dhcp_host_options(host, ethernet)) yield pvl.dhcp.config.Block(('host', name), items, comment=comment)