Remove unused imports, change arguments to be more flexible.

This commit is contained in:
Jeffrey Forman 2012-11-17 13:25:41 -05:00
parent ec1c07c191
commit ee63a3608c
1 changed files with 9 additions and 7 deletions

View File

@ -1,15 +1,17 @@
import dns.tsigkeyring import dns.tsigkeyring
import sys
from models import Key
def create_keyring(key_name): def create_keyring(key_name, key_data):
"""Accept a TSIG keyfile and a key name to retrieve. """Return a tsigkeyring object from key name and key data.
Return a keyring object with the key name and TSIG secret."""
key_dict = Key.objects.get(name=key_name) Args:
key_name: String representation of key name
key_data: String representation of TSIG key hash
Return:
keyring object with the key name and TSIG secret."""
keyring = dns.tsigkeyring.from_text({ keyring = dns.tsigkeyring.from_text({
key_dict.name : key_dict.data key_name : key_data
}) })
return keyring return keyring