saltstack/salt — Issue #704: msgpack list/tuple conversion leads to silent failures and other problems
Author: hathawsh
Created: 2012-02-16 04:19:30+00:00
State: open

With Salt 0.9.7 on a pair of Ubuntu Lucid boxes, commands fail silently. My configuration files had a compilation error, but nothing was reporting the error even with debug-level logging. I tracked the problem down to the following nasty surprise:

>>> import msgpack
>>> msgpack.loads(msgpack.dumps([1]))
(1,)

In other words, msgpack deserializes lists as Python tuples by default. Much of the code in Salt is not equipped to handle tuples. In particular, output.py expects errors to be contained in a list, but since msgpack is generating tuple instead, output.py seems to thinks no error occurred and I get cryptic, nearly-empty output.

There are at least 2 simple solutions. We can either add "use_list=True" to the msgpack.loads() call, or we can update all isinstance() checks to treat tuples the same as lists. I think I prefer the former solution. What do you think?