diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index 16f7f66476..2faee7aafc 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -29,7 +29,7 @@ import salt.ext.six as six from salt.utils import vt from salt.exceptions import CommandExecutionError, TimedProcTimeoutError from salt.log import LOG_LEVELS -from salt.ext.six.moves import range +from salt.ext.six.moves import range, zip from salt.ext.six.moves import shlex_quote as _cmd_quote # Only available on POSIX systems, nonfatal on windows @@ -394,9 +394,9 @@ def _run(cmd, import itertools env_runas = dict(itertools.izip(*[iter(env_encoded.split(b'\0'))]*2)) elif six.PY3: - if isinstance(env_encoded, str): - env_encoded = env_encoded.encode(__salt_system_encoding__) - env_runas = dict(zip(*[iter(env_encoded.split(b'\0'))]*2)) + if isinstance(env_encoded, str): + env_encoded = env_encoded.encode(__salt_system_encoding__) + env_runas = dict(list(zip(*[iter(env_encoded.split(b'\0'))]*2))) env_runas.update(env) env = env_runas # Encode unicode kwargs to filesystem encoding to avoid a