mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #28340 from jfindlay/decode_client
sdecode file and dir lists in fileclient
This commit is contained in:
commit
7000b6ee8f
1 changed files with 6 additions and 11 deletions
|
@ -28,6 +28,7 @@ import salt.utils.templates
|
|||
import salt.utils.url
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.http
|
||||
from salt.utils.locales import sdecode
|
||||
from salt.utils.openstack.swift import SaltSwift
|
||||
|
||||
# pylint: disable=no-name-in-module,import-error
|
||||
|
@ -213,8 +214,7 @@ class Client(object):
|
|||
|
||||
ret = []
|
||||
|
||||
path = salt.utils.locales.sdecode(path)
|
||||
path = self._check_proto(path)
|
||||
path = self._check_proto(sdecode(path))
|
||||
# We want to make sure files start with this *directory*, use
|
||||
# '/' explicitly because the master (that's generating the
|
||||
# list of files) only runs on POSIX
|
||||
|
@ -229,7 +229,6 @@ class Client(object):
|
|||
# go through the list of all files finding ones that are in
|
||||
# the target directory and caching them
|
||||
for fn_ in self.file_list(saltenv):
|
||||
fn_ = salt.utils.locales.sdecode(fn_)
|
||||
if fn_.strip() and fn_.startswith(path):
|
||||
if salt.utils.check_include_exclude(
|
||||
fn_, include_pat, exclude_pat):
|
||||
|
@ -794,12 +793,8 @@ class LocalClient(Client):
|
|||
os.path.join(path, prefix), followlinks=True
|
||||
):
|
||||
for fname in files:
|
||||
ret.append(
|
||||
os.path.relpath(
|
||||
os.path.join(root, fname),
|
||||
path
|
||||
)
|
||||
)
|
||||
relpath = os.path.relpath(os.path.join(root, fname), path)
|
||||
ret.append(sdecode(relpath))
|
||||
return ret
|
||||
|
||||
def file_list_emptydirs(self, saltenv='base', prefix='', env=None):
|
||||
|
@ -826,7 +821,7 @@ class LocalClient(Client):
|
|||
os.path.join(path, prefix), followlinks=True
|
||||
):
|
||||
if len(dirs) == 0 and len(files) == 0:
|
||||
ret.append(os.path.relpath(root, path))
|
||||
ret.append(sdecode(os.path.relpath(root, path)))
|
||||
return ret
|
||||
|
||||
def dir_list(self, saltenv='base', prefix='', env=None):
|
||||
|
@ -852,7 +847,7 @@ class LocalClient(Client):
|
|||
for root, dirs, files in os.walk(
|
||||
os.path.join(path, prefix), followlinks=True
|
||||
):
|
||||
ret.append(os.path.relpath(root, path))
|
||||
ret.append(sdecode(os.path.relpath(root, path)))
|
||||
return ret
|
||||
|
||||
def hash_file(self, path, saltenv='base', env=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue