summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Krizek <tkrizek@redhat.com>2016-09-20 12:10:09 +0200
committerMartin Babinsky <mbabinsk@redhat.com>2016-09-21 10:26:24 +0200
commitddf48f2fef344784b9e1918d2f2ee6feef9d4c04 (patch)
tree8dd78ba5fef99484860a640af62755acd710d2ff
parent8f8e3d008f1de91337a83ea6d271662432209767 (diff)
downloadfreeipa-ddf48f2fef344784b9e1918d2f2ee6feef9d4c04.tar.gz
freeipa-ddf48f2fef344784b9e1918d2f2ee6feef9d4c04.tar.xz
freeipa-ddf48f2fef344784b9e1918d2f2ee6feef9d4c04.zip
Show error message for invalid IPs in client install
Re-raise the thrown exception to get an error message instead of a traceback during ipa-client-install with invalid IP address. https://fedorahosted.org/freeipa/ticket/6340 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
-rw-r--r--ipapython/ipautil.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 6ef39ab12..64901b524 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -133,8 +133,11 @@ class CheckedIPAddress(UnsafeIPAddress):
"""
def __init__(self, addr, match_local=False, parse_netmask=True,
allow_loopback=False, allow_multicast=False):
+ try:
+ super(CheckedIPAddress, self).__init__(addr)
+ except netaddr.core.AddrFormatError as e:
+ raise ValueError(e)
- super(CheckedIPAddress, self).__init__(addr)
if isinstance(addr, CheckedIPAddress):
self.prefixlen = addr.prefixlen
return