Merge pull request #38850 from techhat/stripcache

Strip .p from cache file names
This commit is contained in:
Mike Place 2017-01-23 09:28:45 -07:00 committed by GitHub
commit 5fe6db6201
2 changed files with 6 additions and 2 deletions

View file

@ -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_

View file

@ -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