Make the lower level key also show up in the loader

This commit is contained in:
Thomas S Hatch 2015-04-15 16:37:46 -06:00
parent b0602d661c
commit 59fe49bb2c

View File

@ -980,6 +980,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
module_name
)
)
self._dict[module_name] = salt.utils.odict.OrderedDict()
for attr in getattr(mod, '__load__', dir(mod)):
if attr.startswith('_'):
# private functions are skipped
@ -997,6 +998,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
# if no alias is defined.
funcname = getattr(mod, '__func_alias__', {}).get(attr, attr)
self._dict['{0}.{1}'.format(module_name, funcname)] = func
setattr(self._dict[module_name], funcname, func)
self._apply_outputter(func, mod)
# enforce depends
@ -1009,9 +1011,12 @@ class LazyLoader(salt.utils.lazy.LazyDict):
Load a single item if you have it
'''
# if the key doesn't have a '.' then it isn't valid for this mod dict
if not isinstance(key, six.string_types) or '.' not in key:
if not isinstance(key, six.string_types):
raise KeyError
mod_name, _ = key.split('.', 1)
if '.' not in key:
mod_name = key
else:
mod_name, _ = key.split('.', 1)
if mod_name in self.missing_modules:
return True
# if the modulename isn't in the whitelist, don't bother