mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #38850 from techhat/stripcache
Strip .p from cache file names
This commit is contained in:
commit
5fe6db6201
2 changed files with 6 additions and 2 deletions
6
salt/cache/localfs.py
vendored
6
salt/cache/localfs.py
vendored
|
@ -126,13 +126,17 @@ def list_(bank, cachedir):
|
|||
if not os.path.isdir(base):
|
||||
return []
|
||||
try:
|
||||
return os.listdir(base)
|
||||
items = os.listdir(base)
|
||||
except OSError as exc:
|
||||
raise SaltCacheError(
|
||||
'There was an error accessing directory "{0}": {1}'.format(
|
||||
base, exc
|
||||
)
|
||||
)
|
||||
ret = []
|
||||
for item in items:
|
||||
ret.append(item.rstrip('.p'))
|
||||
return ret
|
||||
|
||||
|
||||
getlist = list_
|
||||
|
|
2
tests/unit/cache/localfs_test.py
vendored
2
tests/unit/cache/localfs_test.py
vendored
|
@ -241,7 +241,7 @@ class LocalFSTest(TestCase):
|
|||
|
||||
# Now test the return of the list function
|
||||
with patch.dict(localfs.__opts__, {'cachedir': tmp_dir}):
|
||||
self.assertEqual(localfs.list_(bank='bank', cachedir=tmp_dir), ['key.p'])
|
||||
self.assertEqual(localfs.list_(bank='bank', cachedir=tmp_dir), ['key'])
|
||||
|
||||
# 'contains' function tests: 1
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue