Skip to content

Instantly share code, notes, and snippets.

@lubo
Last active September 27, 2020 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lubo/ac7686699f6b5a27873e462ad495c170 to your computer and use it in GitHub Desktop.
Save lubo/ac7686699f6b5a27873e462ad495c170 to your computer and use it in GitHub Desktop.
Fixes binary output in Salt highstate logs
#!/usr/bin/env python3
import ast
import fileinput
try:
for line in fileinput.input():
line = line.rstrip('\n')
try:
line = ast.literal_eval(line).decode()
except (AttributeError, SyntaxError):
pass
try:
print(line)
except BrokenPipeError:
break
except KeyboardInterrupt:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment