From 75ed63a871ecf2cc8c6e405617f9e8a9f252bd88 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 7 Mar 2023 10:56:44 +0100 Subject: [PATCH 1/2] Fix import errors caused by ansible.netcommon 2.0.0 breaking changes --- plugins/modules/cnos_l3_interface.py | 6 ++++-- plugins/modules/icx_l3_interface.py | 5 ++++- plugins/modules/slxos_l3_interface.py | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/modules/cnos_l3_interface.py b/plugins/modules/cnos_l3_interface.py index a7a0e81d..9874b30a 100644 --- a/plugins/modules/cnos_l3_interface.py +++ b/plugins/modules/cnos_l3_interface.py @@ -125,8 +125,10 @@ from ansible_collections.community.network.plugins.module_utils.network.cnos.cnos import run_commands from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import NetworkConfig from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_netmask, to_masklen +try: + from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen, to_netmask, to_masklen +except ImportError: + from ansible.module_utils.common.network import is_netmask, is_masklen, to_netmask, to_masklen def validate_ipv4(value, module): diff --git a/plugins/modules/icx_l3_interface.py b/plugins/modules/icx_l3_interface.py index d0f7ca84..98d8c154 100644 --- a/plugins/modules/icx_l3_interface.py +++ b/plugins/modules/icx_l3_interface.py @@ -197,7 +197,10 @@ from ansible_collections.community.network.plugins.module_utils.network.icx.icx import get_config, load_config from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import NetworkConfig from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen, to_netmask, to_masklen +try: + from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen, to_netmask, to_masklen +except ImportError: + from ansible.module_utils.common.network import is_netmask, is_masklen, to_netmask, to_masklen def validate_ipv4(value, module): diff --git a/plugins/modules/slxos_l3_interface.py b/plugins/modules/slxos_l3_interface.py index 240f1024..ad329d1f 100644 --- a/plugins/modules/slxos_l3_interface.py +++ b/plugins/modules/slxos_l3_interface.py @@ -107,7 +107,10 @@ from ansible_collections.community.network.plugins.module_utils.network.slxos.slxos import get_config, load_config from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import NetworkConfig from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import conditional, remove_default_spec -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen, to_netmask, to_masklen +try: + from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import is_netmask, is_masklen, to_netmask, to_masklen +except ImportError: + from ansible.module_utils.common.network import is_netmask, is_masklen, to_netmask, to_masklen def validate_ipv4(value, module): From aac1a82aab264d94102f19a06e9239760a996bf8 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 7 Mar 2023 11:00:33 +0100 Subject: [PATCH 2/2] Add changelog fragment --- changelogs/fragments/0-fix_imports.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/0-fix_imports.yml diff --git a/changelogs/fragments/0-fix_imports.yml b/changelogs/fragments/0-fix_imports.yml new file mode 100644 index 00000000..c1c80027 --- /dev/null +++ b/changelogs/fragments/0-fix_imports.yml @@ -0,0 +1,4 @@ +bugfixes: +- cnos_l3_interface - fix import errors (https://github.com/ansible-collections/community.network/pull/531). +- icx_l3_interface - fix import errors (https://github.com/ansible-collections/community.network/pull/531). +- slxos_l3_interface - fix import errors (https://github.com/ansible-collections/community.network/pull/531).