mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add VERY simple script to read msgpack files
This is meant to make debugging data in msgpack files a little easier
This commit is contained in:
parent
3f9b504991
commit
af579abc66
1 changed files with 28 additions and 0 deletions
28
tests/packdump.py
Normal file
28
tests/packdump.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Simple script to dump the contents of msgpack files to the terminal
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
import os
|
||||
import sys
|
||||
import pprint
|
||||
|
||||
# Import third party libs
|
||||
import 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 = msgpack.loads(fp_.read())
|
||||
pprint.pprint(data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
dump(sys.argv[1])
|
Loading…
Add table
Reference in a new issue