mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Checking instance exists in master._get_cached_minion_data when cache.fetch returns None
This commit is contained in:
parent
855f87554c
commit
ff6f63e9dd
3 changed files with 4 additions and 4 deletions
4
salt/cache/__init__.py
vendored
4
salt/cache/__init__.py
vendored
|
@ -143,8 +143,8 @@ class Cache(object):
|
|||
added by the driver itself.
|
||||
|
||||
:return:
|
||||
Return a python object fetched from the cache or None if the given
|
||||
path or key not found.
|
||||
Return a python object fetched from the cache or and empty dict if
|
||||
the given path or key not found.
|
||||
|
||||
:raises SaltCacheError:
|
||||
Raises an exception if cache driver detected an error accessing data
|
||||
|
|
2
salt/cache/consul.py
vendored
2
salt/cache/consul.py
vendored
|
@ -104,7 +104,7 @@ def fetch(bank, key):
|
|||
try:
|
||||
_, value = api.kv.get(c_key)
|
||||
if value is None:
|
||||
return value
|
||||
return {}
|
||||
return __context__['serial'].loads(value['Value'])
|
||||
except Exception as exc:
|
||||
raise SaltCacheError(
|
||||
|
|
2
salt/cache/localfs.py
vendored
2
salt/cache/localfs.py
vendored
|
@ -61,7 +61,7 @@ def fetch(bank, key, cachedir):
|
|||
key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
|
||||
if not os.path.isfile(key_file):
|
||||
log.debug('Cache file "%s" does not exist', key_file)
|
||||
return None
|
||||
return {}
|
||||
try:
|
||||
with salt.utils.fopen(key_file, 'rb') as fh_:
|
||||
return __context__['serial'].load(fh_)
|
||||
|
|
Loading…
Add table
Reference in a new issue