Skip to content

Instantly share code, notes, and snippets.

@csonto
csonto / lvm-json
Created September 29, 2015 16:22
lvm-json
#!/usr/bin/python
import sys
import json
from lvmjson import *
import argparse
if __name__ == "__main__":
AVAILABLE_COMMANDS = ["lvs", "vgs", "pvs", "dminfo"]
@csonto
csonto / lvm2json
Created September 29, 2015 16:19
lvm2json - filter to format lvs as JSON
#!/usr/bin/python
"""
Filter accepting input in the form
FIELD='VALUE' FIELD2='VALUE2' ...
...
NOTE: Apostrophes are hardcoded separators and `FIELD` may contain only
uppercase letters, digits and underscores.