From bfe341177bda2748763bb0492cfb002607ebd5df Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Mon, 12 Sep 2016 16:08:21 -0400 Subject: [PATCH] Cleanup netcli (#17529) This honestly mostly amounts to Python 3 fixes. --- lib/ansible/module_utils/netcli.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/netcli.py b/lib/ansible/module_utils/netcli.py index 4cda2b16d2b..d92e952cb6a 100644 --- a/lib/ansible/module_utils/netcli.py +++ b/lib/ansible/module_utils/netcli.py @@ -28,11 +28,11 @@ import re import time -import itertools import shlex from ansible.module_utils.basic import BOOLEANS_TRUE, BOOLEANS_FALSE -from ansible.module_utils.six import string_types +from ansible.module_utils.six import string_types, text_type +from ansible.module_utils.six.moves import zip def to_list(val): if isinstance(val, (list, tuple)): @@ -83,7 +83,7 @@ class Cli(object): def run_commands(self): responses = self.connection.run_commands(self._commands) - for resp, cmd in itertools.izip(responses, self._commands): + for resp, cmd in zip(responses, self._commands): cmd.response = resp # wipe out the commands list to avoid issues if additional @@ -189,7 +189,7 @@ class Conditional(object): key, op, val = shlex.split(conditional) self.key = key - self.func = self.func(op) + self.func = self._func(op) self.value = self._cast_value(val) def __call__(self, data): @@ -206,9 +206,9 @@ class Conditional(object): elif re.match(r'^\d+$', value): return int(value) else: - return unicode(value) + return text_type(value) - def func(self, oper): + def _func(self, oper): for func, operators in self.OPERATORS.items(): if oper in operators: return getattr(self, func)