Fix bug preventing minions from unloading custom modules.

This change no longer blindly updates the __salt__ dict for each module upon module refresh but instead rebuilds the dictionary from scratch. Refs #7691.
This commit is contained in:
Mike Place 2013-11-04 14:43:35 -07:00
parent 5abe667471
commit 3efb0a867d

View File

@ -871,9 +871,12 @@ class Loader(object):
# the available modules and inject the special __salt__ namespace that
# contains these functions.
for mod in modules:
if not hasattr(mod, '__salt__'):
if not hasattr(mod, '__salt__') or (
not in_pack(pack, '__salt__') and
not str(mod.__name__).startswith('salt.loaded.int.grain')
):
mod.__salt__ = funcs
elif not in_pack(pack, '__salt__'):
elif not in_pack(pack, '__salt__') and str(mod.__name__).startswith('salt.loaded.int.grain'):
mod.__salt__.update(funcs)
return funcs