From 15f8c6835bb5e452e352db8d169f2991a2a5706a Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 14 Oct 2016 01:50:24 +0200 Subject: Fix unarchive on python3 Since handler.files_in_archive is a list of files coming from various executables output, that's a bytes list, and we use it with dest who is a str. So we need to convert that to native type. --- files/unarchive.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/unarchive.py b/files/unarchive.py index 8af1c410..b51d3979 100644 --- a/files/unarchive.py +++ b/files/unarchive.py @@ -251,7 +251,7 @@ class ZipArchive(object): try: for member in archive.namelist(): if member not in self.excludes: - self._files_in_archive.append(member) + self._files_in_archive.append(to_native(member)) except: archive.close() raise UnarchiveError('Unable to list files in the archive') @@ -623,7 +623,7 @@ class TgzArchive(object): # filename = filename.decode('string_escape') filename = codecs.escape_decode(filename)[0] if filename and filename not in self.excludes: - self._files_in_archive.append(filename) + self._files_in_archive.append(to_native(filename)) return self._files_in_archive def is_unarchived(self): @@ -863,5 +863,7 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * +from ansible.module_utils._text import to_native + if __name__ == '__main__': main() -- cgit v1.2.1