[or-cvs] r17350: {updater} fix/document issues noted by arma in todo. (updater/trunk/lib/thandy)

nickm at seul.org nickm at seul.org
Fri Nov 21 05:48:14 UTC 2008


Author: nickm
Date: 2008-11-21 00:48:13 -0500 (Fri, 21 Nov 2008)
New Revision: 17350

Modified:
   updater/trunk/lib/thandy/SignerCLI.py
   updater/trunk/lib/thandy/formats.py
   updater/trunk/lib/thandy/keys.py
Log:
fix/document issues noted by arma in todo.

Modified: updater/trunk/lib/thandy/SignerCLI.py
===================================================================
--- updater/trunk/lib/thandy/SignerCLI.py	2008-11-21 04:06:50 UTC (rev 17349)
+++ updater/trunk/lib/thandy/SignerCLI.py	2008-11-21 05:48:13 UTC (rev 17350)
@@ -305,7 +305,10 @@
     if cmd in [ "keygen", "listkeys", "addrole", "delrole", "chpass",
                 "dumpkey", "makepackage", "makebundle", "signkeylist",
                 "makekeylist", "signkeylist", "makemirrorlist", ]:
-        globals()[cmd](args)
+        try:
+            globals()[cmd](args)
+        except thandy.BadPassword:
+            print >>sys.stderr, "Password incorrect."
     else:
         usage()
 

Modified: updater/trunk/lib/thandy/formats.py
===================================================================
--- updater/trunk/lib/thandy/formats.py	2008-11-21 04:06:50 UTC (rev 17349)
+++ updater/trunk/lib/thandy/formats.py	2008-11-21 05:48:13 UTC (rev 17350)
@@ -790,6 +790,9 @@
     klist = []
     for k in keys:
         k = thandy.keys.RSAKey.fromJSon(k)
+        if includePrivate and not k.isPrivateKey():
+            raise thandy.FormatException("Private key information not found.")
+
         klist.append({'key': k.format(private=includePrivate), 'roles' : k.getRoles() })
 
     result = { '_type' : "Keylist",

Modified: updater/trunk/lib/thandy/keys.py
===================================================================
--- updater/trunk/lib/thandy/keys.py	2008-11-21 04:06:50 UTC (rev 17349)
+++ updater/trunk/lib/thandy/keys.py	2008-11-21 05:48:13 UTC (rev 17350)
@@ -47,7 +47,8 @@
            paths.
         """
         assert role in thandy.formats.ALL_ROLES
-        self._roles.append((role, path))
+        if (role, path) not in self._roles:
+            self._roles.append((role, path))
     def clearRoles(self):
         """Remove all roles from this key."""
         del self._roles[:]



More information about the tor-commits mailing list