Development
This commit is contained in:
parent
91d8b950b7
commit
ba74852d8a
2 changed files with 17 additions and 11 deletions
|
|
@ -39,8 +39,7 @@ def _flat_index_to_vlan_res(vlans, flat_idx):
|
|||
def _parse_ip():
|
||||
raw = request.form.get('ip', '').strip()
|
||||
if not raw:
|
||||
flash('The configuration has not been saved because an IP address is required.', 'error')
|
||||
return None
|
||||
return 'dynamic'
|
||||
ip = validate.ip(raw)
|
||||
if not ip:
|
||||
flash(f'The configuration has not been saved because "{raw}" is not a valid IP address.', 'error')
|
||||
|
|
@ -49,6 +48,8 @@ def _parse_ip():
|
|||
|
||||
|
||||
def _check_ip_conflicts(ip, vlan):
|
||||
if ip == 'dynamic':
|
||||
return None
|
||||
dhcp = vlan.get('dhcp_information', {})
|
||||
pool_start = dhcp.get('dynamic_pool_start')
|
||||
pool_end = dhcp.get('dynamic_pool_end')
|
||||
|
|
@ -117,7 +118,7 @@ def add_dhcp_reservation():
|
|||
cfg,
|
||||
path=f'vlans.{vlan_name}.reservations', key=mac, operation='add',
|
||||
before=None, after=entry,
|
||||
description=f'Added DHCP reservation: {hostname or mac} ({ip})',
|
||||
description=f'Added DHCP reservation: {hostname or mac} ({ip or "dynamic"})',
|
||||
), 'success')
|
||||
return redirect(VIEW)
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ def edit_dhcp_reservation():
|
|||
cfg,
|
||||
path=f'vlans.{vlan_name}.reservations', key=mac, operation='edit',
|
||||
before=before, after=copy.deepcopy(res),
|
||||
description=f'Edited DHCP reservation: {hostname or mac} ({ip})',
|
||||
description=f'Edited DHCP reservation: {hostname or mac} ({ip or "dynamic"})',
|
||||
), 'success')
|
||||
return redirect(VIEW)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue