mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Properly print non-strings with the TxtOutputter
After adding support for using different outputters for salt-call -g, I noticed it would blow up with ran with --text-out as pythonpath and cpu_flags aren't strings. Now just print the equiv of repr() on non-strings and all will be well.
This commit is contained in:
parent
7a899b9236
commit
aad52f503b
@ -136,8 +136,12 @@ class TxtOutputter(Outputter):
|
||||
if hasattr(data, "keys"):
|
||||
for key in data.keys():
|
||||
value = data[key]
|
||||
for line in value.split('\n'):
|
||||
print "{0}: {1}".format(key, line)
|
||||
# Don't blow up on non-strings
|
||||
try:
|
||||
for line in value.split('\n'):
|
||||
print "{0}: {1}".format(key, line)
|
||||
except AttributeError:
|
||||
print "key: %s" % value
|
||||
else:
|
||||
# For non-dictionary data, just use print
|
||||
RawOutputter()(data)
|
||||
|
Loading…
Reference in New Issue
Block a user