Development
This commit is contained in:
parent
705c69abc4
commit
470cc39356
5 changed files with 244 additions and 245 deletions
|
|
@ -334,11 +334,10 @@ def config_datasource(name):
|
|||
|
||||
if name == 'dhcp_reservations':
|
||||
rows = []
|
||||
for vlan in vlans:
|
||||
for res in vlan.get('reservations', []):
|
||||
row = dict(res)
|
||||
row['vlan_name'] = vlan.get('name', '-')
|
||||
rows.append(row)
|
||||
for res in cfg.get('dhcp_reservations', []):
|
||||
row = dict(res)
|
||||
row['vlan_name'] = res.get('vlan', '-')
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
if name == 'ddns_providers':
|
||||
|
|
@ -795,10 +794,9 @@ def collect_tokens():
|
|||
_vn = _v.get('name', '')
|
||||
if not _vn:
|
||||
continue
|
||||
_res_ips_by_vlan[_vn] = [r['ip'] for r in _v.get('reservations', [])
|
||||
if r.get('ip') and r['ip'] != 'dynamic']
|
||||
_res_hosts_by_vlan[_vn] = [r['hostname'] for r in _v.get('reservations', [])
|
||||
if r.get('hostname')]
|
||||
_vlan_res = [r for r in cfg.get('dhcp_reservations', []) if r.get('vlan') == _vn]
|
||||
_res_ips_by_vlan[_vn] = [r['ip'] for r in _vlan_res if r.get('ip') and r['ip'] != 'dynamic']
|
||||
_res_hosts_by_vlan[_vn] = [r['hostname'] for r in _vlan_res if r.get('hostname')]
|
||||
tokens['RESERVATION_IPS_BY_VLAN_JSON'] = json.dumps(_res_ips_by_vlan)
|
||||
tokens['RESERVATION_HOSTNAMES_BY_VLAN_JSON'] = json.dumps(_res_hosts_by_vlan)
|
||||
tokens['EXISTING_VLAN_IDS_JSON'] = json.dumps([v.get('vlan_id') for v in vlans])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue