diff options
author | Michael Johnson <johnsomor@gmail.com> | 2022-08-02 21:52:40 +0000 |
---|---|---|
committer | Michael Johnson <johnsomor@gmail.com> | 2022-08-02 22:02:13 +0000 |
commit | 968e3d348d57d60016e9b17615234b83fb7bc20c (patch) | |
tree | 872001480130389f08348ce16edf48d7858eb64c /contrib | |
parent | 9876b7b9357765e430833b149fe7480ddb005550 (diff) | |
download | designate-968e3d348d57d60016e9b17615234b83fb7bc20c.tar.gz |
Remove netaddr module requirement
This patch removes the 'netaddr' module from the Designate requirements list.
It replaces the use of netaddr in Designate with the python standard library 'ipaddress' module.
Change-Id: I2fb1549e1d6cbccf58c03810c7d74c8c378682d5
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/fixleadingzeros.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/fixleadingzeros.py b/contrib/fixleadingzeros.py index cdf49f1d..3659a29a 100755 --- a/contrib/fixleadingzeros.py +++ b/contrib/fixleadingzeros.py @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. import argparse +import ipaddress import logging import sys @@ -22,7 +23,6 @@ import dns.exception from dns.ipv4 import inet_aton from keystoneauth1.identity import generic from keystoneauth1 import session as keystone_session -import netaddr from designateclient import shell from designateclient.v2 import client @@ -72,8 +72,9 @@ def fix_bad_recordsets(bad_recordsets): for rs in bad_recordsets: new_records = [] for ip in bad_recordsets[rs]['records']: + ip = '.'.join(f'{int(i)}' for i in ip.split('.')) new_records.append( - str(netaddr.IPAddress(ip, flags=netaddr.ZEROFILL).ipv4()) + str(ipaddress.IPv4Address(ip)) ) bad_recordsets[rs]['records'] = new_records return bad_recordsets |