Fixed diagnostic snapshot generation for master node

* shlex in python 2.6 was broken and doesn't
  work correct with unicode, we have to
  encode it to ascii explicitly
* fixed strings formating, use format
  method
* fixed tests, use assertEqual instead of
  buildin assert method

Closes-bug: #1310927
Change-Id: I4a0746791d4317571d882416cfe75e8a41edf08a