diff --git a/changelogs/fragments/ansiballz-wrapper-sitecustomize.yml b/changelogs/fragments/ansiballz-wrapper-sitecustomize.yml new file mode 100644 index 00000000000..36f2787cfc9 --- /dev/null +++ b/changelogs/fragments/ansiballz-wrapper-sitecustomize.yml @@ -0,0 +1,2 @@ +bugfixes: +- modules - fix AnsiballZ wrapper code escaping of sitecustomize diff --git a/lib/ansible/_internal/_ansiballz/_wrapper.py b/lib/ansible/_internal/_ansiballz/_wrapper.py index 4d9d9b4f4bf..43cf6a69bda 100644 --- a/lib/ansible/_internal/_ansiballz/_wrapper.py +++ b/lib/ansible/_internal/_ansiballz/_wrapper.py @@ -121,7 +121,7 @@ def _ansiballz_main( z = zipfile.ZipFile(modlib_path, mode='a') # py3: modlib_path will be text, py2: it's bytes. Need bytes at the end - sitecustomize = u'import sys\\nsys.path.insert(0,"%s")\\n' % modlib_path + sitecustomize = 'import sys\nsys.path.insert(0, "%s")\n' % modlib_path sitecustomize = sitecustomize.encode('utf-8') # Use a ZipInfo to work around zipfile limitation on hosts with # clocks set to a pre-1980 year (for instance, Raspberry Pi)