From d38cc1e0a1d3d38c0d91d6ccb2a54aed970341b2 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 6 Jul 2016 12:22:42 -0700 Subject: [PATCH] Remove doubled instantiation of the zipfile (#16609) --- lib/ansible/executor/module_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py index 9d9abf2cf00..efae53fbc00 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -290,8 +290,8 @@ if __name__ == '__main__': # may load the system-wide install of ansible rather than the one in # the module. sitecustomize is the only way to override that setting. z = zipfile.ZipFile(zipped_mod, mode='a') + # py3: zipped_mod will be text, py2: it's bytes. Need bytes at the end - z = zipfile.ZipFile(zipped_mod, mode='a') sitecustomize = u'import sys\\nsys.path.insert(0,"%%s")\\n' %% zipped_mod sitecustomize = sitecustomize.encode('utf-8') z.writestr('sitecustomize.py', sitecustomize)