Remove vendored ipaddress module. (#2441)
parent
188a4eeb0c
commit
9906b9dbc7
|
@ -0,0 +1,5 @@
|
||||||
|
removed_features:
|
||||||
|
- "The vendored copy of ``ipaddress`` has been removed. Please use ``ipaddress`` from the Python 3 standard library, or `from pypi <https://pypi.org/project/ipaddress/>`_. (https://github.com/ansible-collections/community.general/pull/2441)."
|
||||||
|
breaking_changes:
|
||||||
|
- "scaleway_security_group_rule - when used with Python 2, the module now needs ``ipaddress`` installed `from pypi <https://pypi.org/project/ipaddress/>`_ (https://github.com/ansible-collections/community.general/pull/2441)."
|
||||||
|
- "lxd inventory plugin - when used with Python 2, the plugin now needs ``ipaddress`` installed `from pypi <https://pypi.org/project/ipaddress/>`_ (https://github.com/ansible-collections/community.general/pull/2441)."
|
|
@ -13,6 +13,8 @@ DOCUMENTATION = r'''
|
||||||
- Uses a YAML configuration file that ends with 'lxd.(yml|yaml)'.
|
- Uses a YAML configuration file that ends with 'lxd.(yml|yaml)'.
|
||||||
version_added: "3.0.0"
|
version_added: "3.0.0"
|
||||||
author: "Frank Dornheim (@conloos)"
|
author: "Frank Dornheim (@conloos)"
|
||||||
|
requirements:
|
||||||
|
- ipaddress
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: Token that ensures this is a source file for the 'lxd' plugin.
|
description: Token that ensures this is a source file for the 'lxd' plugin.
|
||||||
|
@ -124,10 +126,17 @@ import socket
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin
|
from ansible.plugins.inventory import BaseInventoryPlugin
|
||||||
from ansible.module_utils._text import to_native, to_text
|
from ansible.module_utils._text import to_native, to_text
|
||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
|
from ansible.module_utils.six import raise_from
|
||||||
from ansible.errors import AnsibleError, AnsibleParserError
|
from ansible.errors import AnsibleError, AnsibleParserError
|
||||||
from ansible_collections.community.general.plugins.module_utils.compat import ipaddress
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException
|
from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException
|
||||||
|
|
||||||
|
try:
|
||||||
|
import ipaddress
|
||||||
|
except ImportError as exc:
|
||||||
|
IPADDRESS_IMPORT_ERROR = exc
|
||||||
|
else:
|
||||||
|
IPADDRESS_IMPORT_ERROR = None
|
||||||
|
|
||||||
|
|
||||||
class InventoryModule(BaseInventoryPlugin):
|
class InventoryModule(BaseInventoryPlugin):
|
||||||
DEBUG = 4
|
DEBUG = 4
|
||||||
|
@ -924,6 +933,10 @@ class InventoryModule(BaseInventoryPlugin):
|
||||||
AnsibleParserError
|
AnsibleParserError
|
||||||
Returns:
|
Returns:
|
||||||
None"""
|
None"""
|
||||||
|
if IPADDRESS_IMPORT_ERROR:
|
||||||
|
raise_from(
|
||||||
|
AnsibleError('another_library must be installed to use this plugin'),
|
||||||
|
IPADDRESS_IMPORT_ERROR)
|
||||||
|
|
||||||
super(InventoryModule, self).parse(inventory, loader, path, cache=False)
|
super(InventoryModule, self).parse(inventory, loader, path, cache=False)
|
||||||
# Read the inventory YAML file
|
# Read the inventory YAML file
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,11 +17,12 @@ module: scaleway_security_group_rule
|
||||||
short_description: Scaleway Security Group Rule management module
|
short_description: Scaleway Security Group Rule management module
|
||||||
author: Antoine Barbare (@abarbare)
|
author: Antoine Barbare (@abarbare)
|
||||||
description:
|
description:
|
||||||
- This module manages Security Group Rule on Scaleway account
|
- This module manages Security Group Rule on Scaleway account
|
||||||
U(https://developer.scaleway.com)
|
U(https://developer.scaleway.com)
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.general.scaleway
|
- community.general.scaleway
|
||||||
|
requirements:
|
||||||
|
- ipaddress
|
||||||
|
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
|
@ -129,10 +130,19 @@ data:
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway, payload_from_object
|
from ansible_collections.community.general.plugins.module_utils.scaleway import SCALEWAY_LOCATION, scaleway_argument_spec, Scaleway, payload_from_object
|
||||||
from ansible_collections.community.general.plugins.module_utils.compat.ipaddress import ip_network
|
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_text
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ipaddress import ip_network
|
||||||
|
except ImportError:
|
||||||
|
IPADDRESS_IMP_ERR = traceback.format_exc()
|
||||||
|
HAS_IPADDRESS = False
|
||||||
|
else:
|
||||||
|
HAS_IPADDRESS = True
|
||||||
|
|
||||||
|
|
||||||
def get_sgr_from_api(security_group_rules, security_group_rule):
|
def get_sgr_from_api(security_group_rules, security_group_rule):
|
||||||
|
@ -255,6 +265,8 @@ def main():
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
if not HAS_IPADDRESS:
|
||||||
|
module.fail_json(msg=missing_required_lib('ipaddress'), exception=IPADDRESS_IMP_ERR)
|
||||||
|
|
||||||
core(module)
|
core(module)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time
|
plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time
|
||||||
plugins/module_utils/compat/ipaddress.py no-assert
|
|
||||||
plugins/module_utils/compat/ipaddress.py no-unicode-literals
|
|
||||||
plugins/module_utils/_mount.py future-import-boilerplate
|
plugins/module_utils/_mount.py future-import-boilerplate
|
||||||
plugins/module_utils/_mount.py metaclass-boilerplate
|
plugins/module_utils/_mount.py metaclass-boilerplate
|
||||||
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
plugins/module_utils/compat/ipaddress.py no-assert
|
|
||||||
plugins/module_utils/compat/ipaddress.py no-unicode-literals
|
|
||||||
plugins/module_utils/_mount.py future-import-boilerplate
|
plugins/module_utils/_mount.py future-import-boilerplate
|
||||||
plugins/module_utils/_mount.py metaclass-boilerplate
|
plugins/module_utils/_mount.py metaclass-boilerplate
|
||||||
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
plugins/module_utils/compat/ipaddress.py no-assert
|
|
||||||
plugins/module_utils/compat/ipaddress.py no-unicode-literals
|
|
||||||
plugins/module_utils/_mount.py future-import-boilerplate
|
plugins/module_utils/_mount.py future-import-boilerplate
|
||||||
plugins/module_utils/_mount.py metaclass-boilerplate
|
plugins/module_utils/_mount.py metaclass-boilerplate
|
||||||
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
plugins/modules/cloud/linode/linode.py validate-modules:parameter-list-no-elements
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time
|
plugins/module_utils/cloud.py pylint:bad-option-value # a pylint test that is disabled was modified over time
|
||||||
plugins/module_utils/compat/ipaddress.py no-assert
|
|
||||||
plugins/module_utils/compat/ipaddress.py no-unicode-literals
|
|
||||||
plugins/module_utils/_mount.py future-import-boilerplate
|
plugins/module_utils/_mount.py future-import-boilerplate
|
||||||
plugins/module_utils/_mount.py metaclass-boilerplate
|
plugins/module_utils/_mount.py metaclass-boilerplate
|
||||||
plugins/modules/cloud/linode/linode.py validate-modules:parameter-type-not-in-doc
|
plugins/modules/cloud/linode/linode.py validate-modules:parameter-type-not-in-doc
|
||||||
|
|
Loading…
Reference in New Issue