Make the verify script check both v1 and v2 entities
authorJakob Cornell <jakob+gpg@jcornell.net>
Mon, 21 Feb 2022 19:18:01 +0000 (13:18 -0600)
committerJakob Cornell <jakob+gpg@jcornell.net>
Mon, 21 Feb 2022 20:29:58 +0000 (14:29 -0600)
I'm not entirely sure this will work on disks that mix v1 and v2 entities.

disk_jumble/src/disk_jumble/verify.py

index 684739d7ba6cbeb71a330912275ac99f60caa4e2..c63f8768b60c92293a3541825d33dc8f3cd351b5 100644 (file)
@@ -371,7 +371,6 @@ if __name__ == "__main__":
                        raise ValueError()
 
        parser = argparse.ArgumentParser()
-       parser.add_argument("entity_version", choices = ["1", "2"])
        parser.add_argument("disk_id", type = int)
        parser.add_argument(
                "read_tries",
@@ -384,7 +383,5 @@ if __name__ == "__main__":
                conn.autocommit = True
                path = f"/dev/mapper/diskjumble-{args.disk_id}"
                with open(path, "rb", buffering = _READ_BUFFER_SIZE) as disk_file:
-                       if args.entity_version == "1":
-                               do_verify(conn, args.disk_id, SECTOR_SIZE, disk_file, _READ_BUFFER_SIZE, args.read_tries)
-                       else:
-                               do_verify_v2(conn, args.disk_id, disk_file, _READ_BUFFER_SIZE, args.read_tries)
+                       do_verify(conn, args.disk_id, SECTOR_SIZE, disk_file, _READ_BUFFER_SIZE, args.read_tries)
+                       do_verify_v2(conn, args.disk_id, disk_file, _READ_BUFFER_SIZE, args.read_tries)