|
|
@ -41,8 +41,11 @@ class LookupModule(object):
|
|
|
|
raise errors.AnsibleError("Can't LOOKUP(dnstxt): module dns.resolver is not installed")
|
|
|
|
raise errors.AnsibleError("Can't LOOKUP(dnstxt): module dns.resolver is not installed")
|
|
|
|
|
|
|
|
|
|
|
|
def run(self, terms, **kwargs):
|
|
|
|
def run(self, terms, **kwargs):
|
|
|
|
|
|
|
|
if isinstance(terms, basestring):
|
|
|
|
domain = terms.split()[0]
|
|
|
|
terms = [ terms ]
|
|
|
|
|
|
|
|
ret = []
|
|
|
|
|
|
|
|
for term in terms:
|
|
|
|
|
|
|
|
domain = term.split()[0]
|
|
|
|
string = []
|
|
|
|
string = []
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
answers = dns.resolver.query(domain, 'TXT')
|
|
|
|
answers = dns.resolver.query(domain, 'TXT')
|
|
|
@ -57,4 +60,5 @@ class LookupModule(object):
|
|
|
|
except dns.exception.DNSException as e:
|
|
|
|
except dns.exception.DNSException as e:
|
|
|
|
raise errors.AnsibleError("dns.resolver unhandled exception", e)
|
|
|
|
raise errors.AnsibleError("dns.resolver unhandled exception", e)
|
|
|
|
|
|
|
|
|
|
|
|
return ''.join(string)
|
|
|
|
ret.append(''.join(string))
|
|
|
|
|
|
|
|
return ret
|
|
|
|