diff options
author | Christian Poessinger <christian@poessinger.com> | 2018-08-29 22:33:40 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2018-08-29 22:33:40 +0200 |
commit | eb5a1be8845e75c115910d96b1bc468c872ce705 (patch) | |
tree | 44294ebf9b768ab9df7d9e6ed6a6fd7bc18407d9 /src/conf_mode | |
parent | f5311c1732009f927ea1b47966e4a296d62b2ce8 (diff) | |
download | vyos-1x-eb5a1be8845e75c115910d96b1bc468c872ce705.tar.gz vyos-1x-eb5a1be8845e75c115910d96b1bc468c872ce705.zip |
dhcp_server.py: beautify error messages generated in verify()
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/dhcp_server.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index 556545e6d..0f92985a9 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -602,12 +602,14 @@ def verify(dhcp): # If DHCP is enabled we need one share-network if len(dhcp['shared_network']) == 0: - raise ConfigError('No DHCP shared networks configured. At least one DHCP shared network must be configured.') + raise ConfigError('No DHCP shared networks configured.\n' + 'At least one DHCP shared network must be configured.') # A shared-network requires a subnet definition for network in dhcp['shared_network']: if len(network['subnet']) == 0: - raise ConfigError('No DHCP lease subnets configured for "{0}". At least one DHCP lease subnet must be configured for each shared network.'.format(network['name'])) + raise ConfigError('No DHCP lease subnets configured for "{0}". At least one\n' + 'lease subnet must be configured for each shared network.'.format(network['name'])) # Inspect our subnet configuration failover_names = [] @@ -633,7 +635,7 @@ def verify(dhcp): # Failover requires start/stop ranges for pool if (len(subnet['range']) == 0): - raise ConfigError('Atleast one start-stop range must be configured for $subnet to set up DHCP failover.') + raise ConfigError('Atleast one start-stop range must be configured for "{0}" to set up DHCP failover.'.format(subnet['network'])) # Check if DHCP address range is inside configured subnet declaration range_start = [] @@ -730,7 +732,9 @@ def verify(dhcp): raise ConfigError('Conflicting subnet ranges: "{0}" overlaps "{1}"'.format(net, net2)) if not listen_ok: - raise ConfigError('None of the DHCP lease subnets are inside any configured subnet on broadcast interfaces. At least one lease subnet must be set such that DHCP server listens on a one broadcast interface') + raise ConfigError('None of the DHCP lease subnets are inside any configured subnet on\n' \ + 'broadcast interfaces. At least one lease subnet must be set such that\n' \ + 'DHCP server listens on a one broadcast interface') return None |