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

Fix module failure due to itertools.izip_longest (#4211) (#4238)

* Fix module failure due to itertools.izip_longest

* Add changelog fragment. Remove itertools import

* Update changelogs/fragments/4206-imc-rest-module.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Boris Vasilev <bvasilev@vmware.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 40f9445aea)

Co-authored-by: Boris <borisvasilev395@gmail.com>
This commit is contained in:
patchback[bot] 2022-02-20 09:53:42 +01:00 committed by GitHub
parent 8a01ad200d
commit bdddc50358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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).

View file

@ -261,7 +261,6 @@ output:
''' '''
import datetime import datetime
import itertools
import os import os
import traceback import traceback
from functools import partial from functools import partial
@ -283,6 +282,7 @@ except ImportError:
HAS_XMLJSON_COBRA = False HAS_XMLJSON_COBRA = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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 from ansible.module_utils.urls import fetch_url
@ -318,7 +318,7 @@ def merge(one, two):
return copy return copy
elif isinstance(one, list) and isinstance(two, list): 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 return one if two is None else two