mirror of
https://github.com/saltstack/salt.git
synced 2025-04-10 06:41:40 +00:00
27 lines
505 B
Python
27 lines
505 B
Python
"""
|
|
Simple script to dump the contents of msgpack files to the terminal
|
|
"""
|
|
|
|
# pylint: disable=resource-leakage
|
|
|
|
import os
|
|
import pprint
|
|
import sys
|
|
|
|
import salt.utils.msgpack
|
|
|
|
|
|
def dump(path):
|
|
"""
|
|
Read in a path and dump the contents to the screen
|
|
"""
|
|
if not os.path.isfile(path):
|
|
print("Not a file")
|
|
return
|
|
with open(path, "rb") as fp_:
|
|
data = salt.utils.msgpack.loads(fp_.read())
|
|
pprint.pprint(data)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
dump(sys.argv[1])
|