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.
This commit is contained in:
parent
7a0ef069fa
commit
a567942405
1 changed files with 4 additions and 2 deletions
|
@ -251,7 +251,7 @@ class ZipArchive(object):
|
||||||
try:
|
try:
|
||||||
for member in archive.namelist():
|
for member in archive.namelist():
|
||||||
if member not in self.excludes:
|
if member not in self.excludes:
|
||||||
self._files_in_archive.append(member)
|
self._files_in_archive.append(to_native(member))
|
||||||
except:
|
except:
|
||||||
archive.close()
|
archive.close()
|
||||||
raise UnarchiveError('Unable to list files in the archive')
|
raise UnarchiveError('Unable to list files in the archive')
|
||||||
|
@ -623,7 +623,7 @@ class TgzArchive(object):
|
||||||
# filename = filename.decode('string_escape')
|
# filename = filename.decode('string_escape')
|
||||||
filename = codecs.escape_decode(filename)[0]
|
filename = codecs.escape_decode(filename)[0]
|
||||||
if filename and filename not in self.excludes:
|
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
|
return self._files_in_archive
|
||||||
|
|
||||||
def is_unarchived(self):
|
def is_unarchived(self):
|
||||||
|
@ -863,5 +863,7 @@ def main():
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
from ansible.module_utils.urls import *
|
from ansible.module_utils.urls import *
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue