diff options
author | Michael Scherer <misc@redhat.com> | 2016-10-14 01:50:24 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-10-15 08:18:41 -0700 |
commit | 15f8c6835bb5e452e352db8d169f2991a2a5706a (patch) | |
tree | 4473782c494284ac8e5b8626e8f46051f455e2fe | |
parent | a35b77a10c8b5e6cf380c01607fbef9d71702d9f (diff) | |
download | ansible-modules-core-15f8c6835bb5e452e352db8d169f2991a2a5706a.tar.gz |
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.
-rw-r--r-- | files/unarchive.py | 6 |
1 files 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() |