From 5c496417983a8a3a5f4c73be033923321a54bdf4 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 18 Sep 2018 01:01:38 +0200 Subject: [PATCH] Port the aix_inittab to python 3 (#45678) Since izip no longer exist on python 3, we need to use zip Fix #45220 --- lib/ansible/modules/system/aix_inittab.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/system/aix_inittab.py b/lib/ansible/modules/system/aix_inittab.py index 165ebbb8b79..acf1fd657a1 100644 --- a/lib/ansible/modules/system/aix_inittab.py +++ b/lib/ansible/modules/system/aix_inittab.py @@ -118,7 +118,12 @@ changed: ''' # Import necessary libraries -import itertools +try: + # python 2 + from itertools import izip +except ImportError: + izip = zip + from ansible.module_utils.basic import AnsibleModule # end import modules @@ -136,7 +141,7 @@ def check_current_entry(module): values = out.split(":") # strip non readable characters as \n values = map(lambda s: s.strip(), values) - existsdict = dict(itertools.izip(keys, values)) + existsdict = dict(izip(keys, values)) existsdict.update({'exist': True}) return existsdict