From: Michael Vrable Date: Tue, 30 Oct 2007 20:43:29 +0000 (-0700) Subject: lbs-util: Add a command for dumping a flattened metadata log file. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=2edfbb7e1a547f1c75b8091955805c6c19e8c31a;p=cumulus.git lbs-util: Add a command for dumping a flattened metadata log file. --- diff --git a/lbs-util b/lbs-util index 267c955..24db4d6 100755 --- a/lbs-util +++ b/lbs-util @@ -103,6 +103,17 @@ def cmd_read_snapshots(snapshots): print d['Segments'].split() store.cleanup() +# Produce a flattened metadata dump from a snapshot +def cmd_read_metadata(snapshot): + get_passphrase() + lowlevel = lbs.LowlevelDataStore(options.store) + store = lbs.ObjectStore(lowlevel) + d = lbs.parse_full(store.load_snapshot(snapshot)) + metadata = lbs.read_metadata(store, d['Root']) + for l in metadata: + sys.stdout.write(l) + store.cleanup() + # Verify snapshot integrity def cmd_verify_snapshots(snapshots): get_passphrase() @@ -230,6 +241,8 @@ elif cmd == 'object-sums': cmd_object_checksums(args) elif cmd == 'read-snapshots': cmd_read_snapshots(args) +elif cmd == 'read-metadata': + cmd_read_metadata(args[0]) elif cmd == 'list-snapshot-sizes': cmd_list_snapshot_sizes() elif cmd == 'verify-snapshots':