Created
May 15, 2015 22:19
-
-
Save spacejam/3c833d7a28a990f3e7f7 to your computer and use it in GitHub Desktop.
etcdump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import etcd, json | |
def traverse(node): | |
if node.dir and len(node._children) != 0: | |
for child in node.children: | |
traverse(c.read(child.key)) | |
elif not node.dir: | |
print node.key | |
try: | |
print json.dumps(json.loads(node.value), | |
sort_keys=True, indent=2, | |
separators=(',', ': ')) | |
except: | |
print node.value | |
c = etcd.Client() | |
root = c.read("/") | |
traverse(root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment