summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Kekane <abhishek.kekane@nttdata.com>2016-05-25 11:45:23 +0530
committerAbhishek Kekane <abhishek.kekane@nttdata.com>2016-05-25 11:55:21 +0530
commit27dbe1e7460f067d5c0841ebc158364211add4e0 (patch)
tree67be9ce2c5dddb901f5d8b0a99c3db3f65043740
parent8f5e65cae3aaf8d0a89d16d8932c266151de44f7 (diff)
downloadoslo-utils-27dbe1e7460f067d5c0841ebc158364211add4e0.tar.gz
Avoid catching generic exception
Replaced 'except Exception' with 'netaddr.AddrFormatError' which will be raised if address is specified as empty string. TrivialFix Change-Id: I3be2fb95b623f7baba057a3936b6071fb82d6a15
-rw-r--r--oslo_utils/netutils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/oslo_utils/netutils.py b/oslo_utils/netutils.py
index 0ad02fd..b639f3f 100644
--- a/oslo_utils/netutils.py
+++ b/oslo_utils/netutils.py
@@ -92,7 +92,7 @@ def is_valid_ipv4(address):
"""
try:
return netaddr.valid_ipv4(address)
- except Exception:
+ except netaddr.AddrFormatError:
return False
@@ -107,7 +107,7 @@ def is_valid_ipv6(address):
"""
try:
return netaddr.valid_ipv6(address)
- except Exception:
+ except netaddr.AddrFormatError:
return False