Skip to content

Instantly share code, notes, and snippets.

@spacejam
Created May 15, 2015 22:19
Show Gist options
  • Save spacejam/3c833d7a28a990f3e7f7 to your computer and use it in GitHub Desktop.
Save spacejam/3c833d7a28a990f3e7f7 to your computer and use it in GitHub Desktop.
etcdump
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
print
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