Merge lp:~ivoks/charm-helpers/no_ip_valueerror into lp:charm-helpers

Proposed by Ante Karamatić
Status: Merged
Merged at revision: 632
Proposed branch: lp:~ivoks/charm-helpers/no_ip_valueerror
Merge into: lp:charm-helpers
Diff against target: 10 lines (+1/-1)
1 file modified
charmhelpers/contrib/network/ip.py (+1/-1)
To merge this branch: bzr merge lp:~ivoks/charm-helpers/no_ip_valueerror
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+306445@code.launchpad.net

Description of the change

Since some values raise ValueError instead of netaddr.core.AddrFormatError exception, this change allows is_ip() to catch both exceptions.

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

LGTM, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/network/ip.py'
2--- charmhelpers/contrib/network/ip.py 2016-07-18 15:59:52 +0000
3+++ charmhelpers/contrib/network/ip.py 2016-09-22 11:56:06 +0000
4@@ -406,7 +406,7 @@
5 # Test to see if already an IPv4/IPv6 address
6 address = netaddr.IPAddress(address)
7 return True
8- except netaddr.AddrFormatError:
9+ except (netaddr.AddrFormatError, ValueError):
10 return False
11
12

Subscribers

People subscribed via source and target branches