Enhance object-checksums command.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Sat, 15 Sep 2007 05:04:20 +0000 (22:04 -0700)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Sat, 15 Sep 2007 05:04:20 +0000 (22:04 -0700)
If no segments are specified, dump object checksums for all segments.
Additionally, prompt for a password (to decrypt segments) when needed.

lbs-util

index 33c9c75..1eac1a0 100755 (executable)
--- a/lbs-util
+++ b/lbs-util
@@ -68,10 +68,14 @@ def cmd_list_snapshot_sizes():
         previous = set(segments)
         print "%s: %.3f +%.3f -%.3f" % (s, size / 1024.0**2, added / 1024.0**2, removed / 1024.0**2)
 
-# Build checksum list for objects in the given segments
+# Build checksum list for objects in the given segments, or all segments if
+# none are specified.
 def cmd_object_checksums(segments):
+    get_passphrase()
     lowlevel = lbs.LowlevelDataStore(options.store)
     store = lbs.ObjectStore(lowlevel)
+    if len(segments) == 0:
+        segments = sorted(lowlevel.list_segments())
     for s in segments:
         for (o, data) in store.load_segment(s):
             csum = lbs.ChecksumCreator().update(data).compute()