Development
This commit is contained in:
parent
ca2091a98b
commit
9e290d958a
3 changed files with 18 additions and 2 deletions
|
|
@ -199,6 +199,12 @@ def networklayout_tablevlans_edit():
|
|||
entry.pop('hostname', None)
|
||||
new_identities.append(entry)
|
||||
|
||||
gateway_raw = sanitize.ip(request.form.get('gateway', ''))
|
||||
inferred_gw = (min(identity_ips, key=lambda ip: int(ip.split('.')[-1]))
|
||||
if identity_ips else '')
|
||||
new_stored_gw = gateway_raw if (gateway_raw and gateway_raw != inferred_gw) else ''
|
||||
existing_gw = existing.get('dhcp_information', {}).get('explicit_overrides', {}).get('gateway', '')
|
||||
|
||||
_ids_unchanged = (
|
||||
len(new_identities) == len(old_identities) and
|
||||
all(
|
||||
|
|
@ -215,7 +221,8 @@ def networklayout_tablevlans_edit():
|
|||
and radius_default == bool(existing.get('radius_default', False))
|
||||
and mdns_reflection == bool(existing.get('mdns_reflection', False))
|
||||
and sorted(use_blocklists) == sorted(existing.get('use_blocklists', []))
|
||||
and _ids_unchanged):
|
||||
and _ids_unchanged
|
||||
and new_stored_gw == existing_gw):
|
||||
flash('No changes were made.', 'info')
|
||||
return redirect(VIEW)
|
||||
|
||||
|
|
@ -231,6 +238,11 @@ def networklayout_tablevlans_edit():
|
|||
'use_blocklists': use_blocklists,
|
||||
'server_identities': new_identities,
|
||||
})
|
||||
dhcp_overrides = existing.setdefault('dhcp_information', {}).setdefault('explicit_overrides', {})
|
||||
if new_stored_gw:
|
||||
dhcp_overrides['gateway'] = new_stored_gw
|
||||
else:
|
||||
dhcp_overrides.pop('gateway', None)
|
||||
errors = validate.validate_config(cfg)
|
||||
if errors:
|
||||
for msg in errors:
|
||||
|
|
|
|||
|
|
@ -322,6 +322,9 @@ def _config_datasource(name):
|
|||
row['server_identity_hostnames'] = json.dumps([
|
||||
s.get('hostname', '') for s in v.get('server_identities', []) if s.get('ip')
|
||||
])
|
||||
row['server_identity_gateway'] = (
|
||||
v.get('dhcp_information', {}).get('explicit_overrides', {}).get('gateway', '')
|
||||
)
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,8 @@
|
|||
"pair_label": "Description (Opt)",
|
||||
"pair_col2": "server_identity_hostnames",
|
||||
"pair_label2": "Hostname (Opt)",
|
||||
"pair_validate2": "networkname"
|
||||
"pair_validate2": "networkname",
|
||||
"gateway_col": "server_identity_gateway"
|
||||
},
|
||||
{
|
||||
"col": "radius_default",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue