Compatibilité 2.8

This commit is contained in:
Yoann Pietri 2020-01-22 21:50:41 +01:00 committed by root
parent 0bf05dbad3
commit 48feb825b8

11
main.py
View file

@ -29,11 +29,12 @@ def regen_dhcp(api_client):
host_mac_ip = {} host_mac_ip = {}
for hmi in api_client.list("dhcp/hostmacip/"): for hmi in api_client.list("dhcp/hostmacip/"):
if hmi['extension'] not in host_mac_ip.keys(): if 'ipv4' in hmi:
host_mac_ip[hmi['extension']] = [] if hmi['extension'] not in host_mac_ip.keys():
host_mac_ip[hmi['extension']].append((hmi['hostname'], host_mac_ip[hmi['extension']] = []
hmi['mac_address'], host_mac_ip[hmi['extension']].append((hmi['hostname'],
hmi['ipv4'])) hmi['mac_address'],
hmi['ipv4']))
template = ("host {hostname}{extension} {{\n" template = ("host {hostname}{extension} {{\n"
" hardware ethernet {mac_address};\n" " hardware ethernet {mac_address};\n"