Updating with requested changes.

This commit is contained in:
Gareth J. Greenaway 2018-05-17 09:20:05 -06:00
parent cc1aa75a2f
commit 5e97b8b44a
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41
2 changed files with 11 additions and 25 deletions

View file

@ -410,23 +410,15 @@ def list_(name,
item.sort()
if verbose:
ret = {'dirs': sorted(dirs),
'files': sorted(files),
'links': sorted(links)}
if six.PY2:
ret['top_level_dirs'] = [x for x in ret['dirs']
if x.decode('utf-8').count('/') == 1]
ret['top_level_files'] = [x for x in ret['files']
if x.decode('utf-8').count('/') == 0]
ret['top_level_links'] = [x for x in ret['links']
if x.decode('utf-8').count('/') == 0]
else:
ret['top_level_dirs'] = [x for x in ret['dirs']
if x.count('/') == 1]
ret['top_level_files'] = [x for x in ret['files']
if x.count('/') == 0]
ret['top_level_links'] = [x for x in ret['links']
if x.count('/') == 0]
ret = {'dirs': sorted(salt.utils.data.decode_list(dirs)),
'files': sorted(salt.utils.data.decode_list(files)),
'links': sorted(salt.utils.data.decode_list(links))}
ret['top_level_dirs'] = [x for x in ret['dirs']
if x.count('/') == 1]
ret['top_level_files'] = [x for x in ret['files']
if x.count('/') == 0]
ret['top_level_links'] = [x for x in ret['links']
if x.count('/') == 0]
else:
ret = sorted(dirs + files + links)
return ret

View file

@ -1090,10 +1090,7 @@ def extracted(name,
and not stat.S_ISDIR(x)),
(contents['links'], stat.S_ISLNK)):
for path in path_list:
if six.PY2:
full_path = os.path.join(name, path.decode('utf-8'))
else:
full_path = os.path.join(name, path)
full_path = salt.utils.path.join(name, path)
try:
path_mode = os.lstat(full_path.rstrip(os.sep)).st_mode
if not func(path_mode):
@ -1262,10 +1259,7 @@ def extracted(name,
if options is None:
try:
with closing(tarfile.open(cached, 'r')) as tar:
if six.PY2:
tar.extractall(salt.utils.to_bytes(name))
else:
tar.extractall(name)
tar.extractall(salt.utils.stringutils.to_str(name))
files = tar.getnames()
if trim_output:
files = files[:trim_output]