mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #48015 from garethgreenaway/47546_more_unicode_nonsense
[2018.3] more unicode nonsense in archive module
This commit is contained in:
commit
406efb161e
@ -186,12 +186,13 @@ def list_(name,
|
||||
else {'fileobj': cached.stdout, 'mode': 'r|'}
|
||||
with contextlib.closing(tarfile.open(**open_kwargs)) as tar_archive:
|
||||
for member in tar_archive.getmembers():
|
||||
_member = salt.utils.data.decode(member.name)
|
||||
if member.issym():
|
||||
links.append(member.name)
|
||||
links.append(_member)
|
||||
elif member.isdir():
|
||||
dirs.append(member.name + '/')
|
||||
dirs.append(_member + '/')
|
||||
else:
|
||||
files.append(member.name)
|
||||
files.append(_member)
|
||||
return dirs, files, links
|
||||
|
||||
except tarfile.ReadError:
|
||||
|
@ -183,6 +183,21 @@ class ArchiveTest(ModuleCase):
|
||||
|
||||
self._tear_down()
|
||||
|
||||
@skipIf(not salt.utils.path.which('tar'), 'Cannot find tar executable')
|
||||
def test_tar_list_unicode(self):
|
||||
'''
|
||||
Validate using the tar function to extract archives
|
||||
'''
|
||||
self._set_up(arch_fmt='tar', unicode_filename=True)
|
||||
self.run_function('archive.tar', ['-cvf', self.arch], sources=self.src)
|
||||
|
||||
# Test list archive
|
||||
ret = self.run_function('archive.list', name=self.arch)
|
||||
self.assertTrue(isinstance(ret, list), six.text_type(ret))
|
||||
self._assert_artifacts_in_ret(ret)
|
||||
|
||||
self._tear_down()
|
||||
|
||||
@skipIf(not salt.utils.path.which('gzip'), 'Cannot find gzip executable')
|
||||
def test_gzip(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user