diff --git a/changelogs/fragments/4206-imc-rest-module.yaml b/changelogs/fragments/4206-imc-rest-module.yaml new file mode 100644 index 0000000000..e36305e31b --- /dev/null +++ b/changelogs/fragments/4206-imc-rest-module.yaml @@ -0,0 +1,2 @@ +bugfixes: + - imc_rest - fixes the module failure due to the usage of ``itertools.izip_longest`` which is not available in Python 3 (https://github.com/ansible-collections/community.general/issues/4206). diff --git a/plugins/modules/remote_management/imc/imc_rest.py b/plugins/modules/remote_management/imc/imc_rest.py index 239c76fab3..b685e96b82 100644 --- a/plugins/modules/remote_management/imc/imc_rest.py +++ b/plugins/modules/remote_management/imc/imc_rest.py @@ -261,7 +261,6 @@ output: ''' import datetime -import itertools import os import traceback from functools import partial @@ -283,6 +282,7 @@ except ImportError: HAS_XMLJSON_COBRA = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.six.moves import zip_longest from ansible.module_utils.urls import fetch_url @@ -318,7 +318,7 @@ def merge(one, two): return copy elif isinstance(one, list) and isinstance(two, list): - return [merge(alpha, beta) for (alpha, beta) in itertools.izip_longest(one, two)] + return [merge(alpha, beta) for (alpha, beta) in zip_longest(one, two)] return one if two is None else two