]> err.no Git - dak/commitdiff
daklib/command.py: give a real error message for unknown fingerprints
authorAnsgar Burchardt <ansgar@debian.org>
Sat, 22 Sep 2012 08:43:46 +0000 (10:43 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 22 Sep 2012 08:43:46 +0000 (10:43 +0200)
daklib/command.py

index fcf4cbb391613df242762e022453af3cbd714a23..451c6b1f69bd2a6ecab7620f5e8f85300c0eb0b9 100644 (file)
@@ -198,7 +198,9 @@ class CommandFile(object):
         acl = session.query(ACL).filter_by(name=acl_name).one()
 
         fpr_hash = section['Fingerprint'].translate(None, ' ')
-        fpr = session.query(Fingerprint).filter_by(fingerprint=fpr_hash).one()
+        fpr = session.query(Fingerprint).filter_by(fingerprint=fpr_hash).first()
+        if fpr is None:
+            raise CommandError('Unknown fingerprint {0}'.format(fpr_hash))
         if fpr.keyring is None or fpr.keyring.keyring_name not in cnf.value_list('Command::DM::Keyrings'):
             raise CommandError('Key {0} is not in DM keyring.'.format(fpr.fingerprint))
         addresses = gpg_get_key_addresses(fpr.fingerprint)