only convert to bytes when using Python2

This commit is contained in:
Gareth J. Greenaway 2018-05-10 11:46:57 -07:00
parent 0fe32f4066
commit cc1aa75a2f
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -1262,7 +1262,10 @@ def extracted(name,
if options is None:
try:
with closing(tarfile.open(cached, 'r')) as tar:
tar.extractall(salt.utils.to_bytes(name))
if six.PY2:
tar.extractall(salt.utils.to_bytes(name))
else:
tar.extractall(name)
files = tar.getnames()
if trim_output:
files = files[:trim_output]