1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove ansible.netcommon dependency. (#1561)

This commit is contained in:
Felix Fontein 2020-12-30 10:37:23 +01:00 committed by GitHub
parent 6c88b69d6f
commit 9f71073d37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 5 deletions

View file

@ -0,0 +1,4 @@
major_changes:
- "The community.general collection no longer depends on the ansible.netcommon collection (https://github.com/ansible-collections/community.general/pull/1561)."
minor_changes:
- "nios_network - no longer requires the ansible.netcommon collection (https://github.com/ansible-collections/community.general/pull/1561)."

View file

@ -9,7 +9,6 @@ license_file: COPYING
tags: [community]
# NOTE: No more dependencies can be added to this list
dependencies:
ansible.netcommon: '>=1.0.0'
community.kubernetes: '>=1.0.0'
repository: https://github.com/ansible-collections/community.general
documentation: https://docs.ansible.com/ansible/latest/collections/community/general/

View file

@ -173,14 +173,39 @@ EXAMPLES = '''
RETURN = ''' # '''
import socket
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import validate_ip_address, validate_ip_v6_address
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_IPV4_NETWORK, NIOS_IPV6_NETWORK
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_IPV4_NETWORK_CONTAINER, NIOS_IPV6_NETWORK_CONTAINER
# The following function validate_ip_address has been taken from
# https://github.com/ansible-collections/ansible.netcommon/blob/20124ecbb420daa0f5bb9cdaa865a952657aa0e7/plugins/module_utils/network/common/utils.py#L496
# The code there is licensed under BSD 2-clause.
# Copyright (c) 2016 Red Hat Inc.
def validate_ip_address(address):
try:
socket.inet_aton(address)
except socket.error:
return False
return address.count(".") == 3
# The following function validate_ip_v6_address has been taken from
# https://github.com/ansible-collections/ansible.netcommon/blob/20124ecbb420daa0f5bb9cdaa865a952657aa0e7/plugins/module_utils/network/common/utils.py#L504
# The code there is licensed under BSD 2-clause.
# Copyright (c) 2016 Red Hat Inc.
def validate_ip_v6_address(address):
try:
socket.inet_pton(socket.AF_INET6, address)
except socket.error:
return False
return True
def options(module):
''' Transforms the module argument into a valid WAPI struct
This function will transform the options argument into a structure that

View file

@ -1,9 +1,7 @@
integration_tests_dependencies:
- ansible.netcommon
- ansible.posix
- community.crypto
- community.kubernetes
unit_tests_dependencies:
- ansible.netcommon
- community.internal_test_tools
- community.kubernetes

View file

@ -74,7 +74,6 @@ else
fi
# START: HACK install dependencies
retry ansible-galaxy -vvv collection install ansible.netcommon
retry ansible-galaxy -vvv collection install community.kubernetes
if [ "${script}" != "sanity" ] || [ "${test}" == "sanity/extra" ]; then