Development
This commit is contained in:
parent
29b06b250c
commit
ca2091a98b
3 changed files with 2 additions and 23 deletions
|
|
@ -199,17 +199,6 @@ def networklayout_tablevlans_edit():
|
||||||
entry.pop('hostname', None)
|
entry.pop('hostname', None)
|
||||||
new_identities.append(entry)
|
new_identities.append(entry)
|
||||||
|
|
||||||
gateway_override = 'gateway_override' in request.form
|
|
||||||
gateway_raw = sanitize.ip(request.form.get('gateway', ''))
|
|
||||||
if gateway_override:
|
|
||||||
if not gateway_raw:
|
|
||||||
flash('Gateway IP is required when override is enabled.', 'error')
|
|
||||||
return redirect(VIEW)
|
|
||||||
if gateway_raw not in identity_ips:
|
|
||||||
flash(f"Gateway '{gateway_raw}' must match one of the server identity IPs.", 'error')
|
|
||||||
return redirect(VIEW)
|
|
||||||
|
|
||||||
_existing_gateway = existing.get('dhcp_information', {}).get('explicit_overrides', {}).get('gateway', '')
|
|
||||||
_ids_unchanged = (
|
_ids_unchanged = (
|
||||||
len(new_identities) == len(old_identities) and
|
len(new_identities) == len(old_identities) and
|
||||||
all(
|
all(
|
||||||
|
|
@ -226,8 +215,7 @@ def networklayout_tablevlans_edit():
|
||||||
and radius_default == bool(existing.get('radius_default', False))
|
and radius_default == bool(existing.get('radius_default', False))
|
||||||
and mdns_reflection == bool(existing.get('mdns_reflection', False))
|
and mdns_reflection == bool(existing.get('mdns_reflection', False))
|
||||||
and sorted(use_blocklists) == sorted(existing.get('use_blocklists', []))
|
and sorted(use_blocklists) == sorted(existing.get('use_blocklists', []))
|
||||||
and _ids_unchanged
|
and _ids_unchanged):
|
||||||
and (gateway_raw if gateway_override else '') == _existing_gateway):
|
|
||||||
flash('No changes were made.', 'info')
|
flash('No changes were made.', 'info')
|
||||||
return redirect(VIEW)
|
return redirect(VIEW)
|
||||||
|
|
||||||
|
|
@ -243,11 +231,6 @@ def networklayout_tablevlans_edit():
|
||||||
'use_blocklists': use_blocklists,
|
'use_blocklists': use_blocklists,
|
||||||
'server_identities': new_identities,
|
'server_identities': new_identities,
|
||||||
})
|
})
|
||||||
dhcp_overrides = existing.setdefault('dhcp_information', {}).setdefault('explicit_overrides', {})
|
|
||||||
if gateway_override:
|
|
||||||
dhcp_overrides['gateway'] = gateway_raw
|
|
||||||
else:
|
|
||||||
dhcp_overrides.pop('gateway', None)
|
|
||||||
errors = validate.validate_config(cfg)
|
errors = validate.validate_config(cfg)
|
||||||
if errors:
|
if errors:
|
||||||
for msg in errors:
|
for msg in errors:
|
||||||
|
|
|
||||||
|
|
@ -322,9 +322,6 @@ def _config_datasource(name):
|
||||||
row['server_identity_hostnames'] = json.dumps([
|
row['server_identity_hostnames'] = json.dumps([
|
||||||
s.get('hostname', '') for s in v.get('server_identities', []) if s.get('ip')
|
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)
|
rows.append(row)
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1585,8 +1585,7 @@
|
||||||
"pair_label": "Description (Opt)",
|
"pair_label": "Description (Opt)",
|
||||||
"pair_col2": "server_identity_hostnames",
|
"pair_col2": "server_identity_hostnames",
|
||||||
"pair_label2": "Hostname (Opt)",
|
"pair_label2": "Hostname (Opt)",
|
||||||
"pair_validate2": "networkname",
|
"pair_validate2": "networkname"
|
||||||
"gateway_col": "server_identity_gateway"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"col": "radius_default",
|
"col": "radius_default",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue