Wrap the split modules in objects, so we can avoid the attr/value ordering problem

This commit is contained in:
Thomas Jackson 2014-10-10 16:40:24 -07:00
parent 9e000ff512
commit aaf0069dd6

View File

@ -231,11 +231,16 @@ def _split_module_dicts():
{{ salt.cmd.run('uptime') }}
'''
class Container():
''' This object allows us to set arbitrary attributes'''
pass
mod_dict = dict(__salt__)
for module_func_name, mod_fun in mod_dict.items():
mod, fun = module_func_name.split('.', 1)
mod_dict.setdefault(mod,
{})[fun] = mod_fun
if mod not in mod_dict:
mod_dict[mod] = Container()
setattr(mod_dict[mod], fun, mod_fun)
return mod_dict