mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Normalize the salt caching API
https://github.com/saltstack/salt/pull/40429 changed the attribute used in `salt/cache/__init__.py` without considering the usage of the cache system elsewhere in the codebase. This led to a cascade of additional changes to try to make everything work correctly. This commit does 2 things: 1) Reverts the calls to the list function to use `list` instead of `ls` to conform with the established API used elsewhere in the codebase. 2) Modifies the cache modules so that they now use `list_` functions, aliased to `list` so that calls to cache loader instances' `*.list` functions elsewhere in the codebase will work.
This commit is contained in:
parent
973d288eca
commit
ee59d127e8
6
salt/cache/__init__.py
vendored
6
salt/cache/__init__.py
vendored
@ -224,7 +224,7 @@ class Cache(object):
|
||||
fun = '{0}.flush'.format(self.driver)
|
||||
return self.modules[fun](bank, key=key, **self._kwargs)
|
||||
|
||||
def ls(self, bank):
|
||||
def list(self, bank):
|
||||
'''
|
||||
Lists entries stored in the specified bank.
|
||||
|
||||
@ -240,11 +240,9 @@ class Cache(object):
|
||||
Raises an exception if cache driver detected an error accessing data
|
||||
in the cache backend (auth, permissions, etc).
|
||||
'''
|
||||
fun = '{0}.ls'.format(self.driver)
|
||||
fun = '{0}.list'.format(self.driver)
|
||||
return self.modules[fun](bank, **self._kwargs)
|
||||
|
||||
list = ls
|
||||
|
||||
def contains(self, bank, key=None):
|
||||
'''
|
||||
Checks if the specified bank contains the specified key.
|
||||
|
4
salt/cache/consul.py
vendored
4
salt/cache/consul.py
vendored
@ -61,7 +61,7 @@ api = None
|
||||
# Define the module's virtual name
|
||||
__virtualname__ = 'consul'
|
||||
|
||||
__func_alias__ = {'list': 'ls'}
|
||||
__func_alias__ = {'list_': 'list'}
|
||||
|
||||
|
||||
def __virtual__():
|
||||
@ -139,7 +139,7 @@ def flush(bank, key=None):
|
||||
)
|
||||
|
||||
|
||||
def ls(bank):
|
||||
def list_(bank):
|
||||
'''
|
||||
Return an iterable object containing all entries stored in the specified bank.
|
||||
'''
|
||||
|
4
salt/cache/localfs.py
vendored
4
salt/cache/localfs.py
vendored
@ -23,7 +23,7 @@ import salt.utils.atomicfile
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__func_alias__ = {'list': 'ls'}
|
||||
__func_alias__ = {'list_': 'list'}
|
||||
|
||||
|
||||
def __cachedir(kwargs=None):
|
||||
@ -143,7 +143,7 @@ def flush(bank, key=None, cachedir=None):
|
||||
return True
|
||||
|
||||
|
||||
def ls(bank, cachedir):
|
||||
def list_(bank, cachedir):
|
||||
'''
|
||||
Return an iterable object containing all entries stored in the specified bank.
|
||||
'''
|
||||
|
6
salt/cache/redis_cache.py
vendored
6
salt/cache/redis_cache.py
vendored
@ -114,9 +114,7 @@ from salt.exceptions import SaltCacheError
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
__virtualname__ = 'redis'
|
||||
__func_alias__ = {
|
||||
'ls': 'list'
|
||||
}
|
||||
__func_alias__ = {'list_': 'list'}
|
||||
|
||||
log = logging.getLogger(__file__)
|
||||
|
||||
@ -418,7 +416,7 @@ def flush(bank, key=None):
|
||||
return True
|
||||
|
||||
|
||||
def ls(bank):
|
||||
def list_(bank):
|
||||
'''
|
||||
Lists entries stored in the specified bank.
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user