Fixes error handling for broken TSIG keys.
The error handling for broken TSIG keys wasn't working for two reasons: * the import of binascii has been missing, producing a NameError once an exception occured * The exception handler was refering to a non-existant variable key_name. This commit fixes both issues.
This commit is contained in:
parent
f0f897fad6
commit
43fe909ec6
|
@ -1,6 +1,7 @@
|
||||||
### Binder Models
|
### Binder Models
|
||||||
|
|
||||||
# Standard Imports
|
# Standard Imports
|
||||||
|
import binascii
|
||||||
import socket
|
import socket
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
@ -38,11 +39,9 @@ class Key(models.Model):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
keyring = dns.tsigkeyring.from_text({
|
keyring = dns.tsigkeyring.from_text({self.name: self.data})
|
||||||
self.name : self.data
|
|
||||||
})
|
|
||||||
except binascii.Error, err:
|
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
|
return keyring
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue