mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Updating with requested changes.
This commit is contained in:
parent
cc1aa75a2f
commit
5e97b8b44a
2 changed files with 11 additions and 25 deletions
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue