From 2edfbb7e1a547f1c75b8091955805c6c19e8c31a Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Tue, 30 Oct 2007 13:43:29 -0700 Subject: [PATCH] lbs-util: Add a command for dumping a flattened metadata log file. --- lbs-util | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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': -- 2.20.1