error message for ip/broadcast/netmask/network validation
This commit is contained in:
@ -782,7 +782,10 @@ class IPOption(Option):
|
||||
only_warning=only_warning)
|
||||
|
||||
def _validate(self, value):
|
||||
IP('{0}/32'.format(value))
|
||||
try:
|
||||
IP('{0}/32'.format(value))
|
||||
except ValueError:
|
||||
raise ValueError(_('invalid IP {0}').format(self._name))
|
||||
|
||||
def _second_level_validation(self, value):
|
||||
ip = IP('{0}/32'.format(value))
|
||||
@ -868,7 +871,10 @@ class NetworkOption(Option):
|
||||
_opt_type = 'network'
|
||||
|
||||
def _validate(self, value):
|
||||
IP(value)
|
||||
try:
|
||||
IP(value)
|
||||
except ValueError:
|
||||
raise ValueError(_('invalid network address {0}').format(self._name))
|
||||
|
||||
def _second_level_validation(self, value):
|
||||
ip = IP(value)
|
||||
@ -882,7 +888,10 @@ class NetmaskOption(Option):
|
||||
_opt_type = 'netmask'
|
||||
|
||||
def _validate(self, value):
|
||||
IP('0.0.0.0/{0}'.format(value))
|
||||
try:
|
||||
IP('0.0.0.0/{0}'.format(value))
|
||||
except ValueError:
|
||||
raise ValueError(_('invalid netmask address {0}').format(self._name))
|
||||
|
||||
def _cons_network_netmask(self, optname, value, value_):
|
||||
#opts must be (netmask, network) options
|
||||
@ -924,7 +933,10 @@ class NetmaskOption(Option):
|
||||
|
||||
class BroadcastOption(Option):
|
||||
def _validate(self, value):
|
||||
IP('{0}/32'.format(value))
|
||||
try:
|
||||
IP('{0}/32'.format(value))
|
||||
except ValueError:
|
||||
raise ValueError(_('invalid broadcast address {0}').format(self._name))
|
||||
|
||||
|
||||
class DomainnameOption(Option):
|
||||
|
Reference in New Issue
Block a user