Merge pull request #12 from Dunedan/fix-errorhandling-for-incorrect-keys

Fixes error handling for broken TSIG keys.
This commit is contained in:
Jeffrey Forman 2015-03-22 14:10:32 -04:00
commit fb43a9aa5a
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,7 @@
### Binder Models
# Standard Imports
import binascii
import socket
import urllib2
@ -47,11 +48,9 @@ class Key(models.Model):
return None
try:
keyring = dns.tsigkeyring.from_text({
self.name : self.data
})
keyring = dns.tsigkeyring.from_text({self.name: self.data})
except binascii.Error, err:
raise exceptions.KeyringException("Incorrect key data. Verify key: %s. Reason: %s" % (key_name, err))
raise exceptions.KeyringException("Incorrect key data. Verify key: %s. Reason: %s" % (self.name, err))
return keyring