diff --git a/plugins/lookup/aws_service_ip_ranges.py b/plugins/lookup/aws_service_ip_ranges.py index fa579c059bc..a6097ea1428 100644 --- a/plugins/lookup/aws_service_ip_ranges.py +++ b/plugins/lookup/aws_service_ip_ranges.py @@ -43,12 +43,6 @@ """ import json -try: - import netaddr -except ImportError as imp_exc: - NETADDR_LIBRARY_IMPORT_ERROR = imp_exc -else: - NETADDR_LIBRARY_IMPORT_ERROR = None from ansible.module_utils.six import raise_from from ansible.errors import AnsibleError @@ -61,24 +55,6 @@ from ansible.plugins.lookup import LookupBase -def valid_cidr(ip_address): - """ - Validate IP address - """ - if NETADDR_LIBRARY_IMPORT_ERROR: - raise_from( - AnsibleError('netaddr must be installed to use this plugin'), - NETADDR_LIBRARY_IMPORT_ERROR) - try: - netaddr.IPNetwork(ip_address) - except netaddr.core.AddrFormatError as e: - raise AnsibleError("Not a valid IP address: %s" % e) - cidr = ip_address.split('/') - if (len(cidr) <= 1 or cidr[1] == ''): - return False - return True - - class LookupModule(LookupBase): def run(self, terms, variables, **kwargs): if "ipv6_prefixes" in kwargs and kwargs["ipv6_prefixes"]: @@ -110,6 +86,5 @@ def run(self, terms, variables, **kwargs): if 'service' in kwargs: service = str.upper(kwargs['service']) amazon_response = (item for item in amazon_response if item['service'] == service) - iprange = [item[ip_prefix_label] for item in amazon_response] return iprange diff --git a/requirements.txt b/requirements.txt index f73aa68210f..0d58b96112d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ boto>=2.49.0 botocore>=1.16.0 boto3>=1.13.0 -netaddr>=0.8.0