mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add error logging when whitelist lookup fails
Rather than just raising a bare KeyError with no additional information, this raises a proper KeyError with the key that failed to be looked up. It also logs the key that failed to load, as well as the whitelist, to aid in troubleshooting.
This commit is contained in:
parent
cb04d9c37e
commit
d4f2662e5b
1 changed files with 5 additions and 1 deletions
|
@ -1629,7 +1629,11 @@ class LazyLoader(salt.utils.lazy.LazyDict):
|
|||
return True
|
||||
# if the modulename isn't in the whitelist, don't bother
|
||||
if self.whitelist and mod_name not in self.whitelist:
|
||||
raise KeyError
|
||||
log.error(
|
||||
'Failed to load key %s because its module (%s) is not in '
|
||||
'the whitelist: %s', key, mod_name, self.whitelist
|
||||
)
|
||||
raise KeyError(key)
|
||||
|
||||
def _inner_load(mod_name):
|
||||
for name in self._iter_files(mod_name):
|
||||
|
|
Loading…
Add table
Reference in a new issue