Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
bd55899a
Commit
bd55899a
authored
Nov 10, 2012
by
Jan-Piet Mens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
$LOOKUP(dnstxt): handle exceptions
de-spaced
parent
38d9dc8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
lib/ansible/runner/lookup_plugins/dnstxt.py
+13
-4
No files found.
lib/ansible/runner/lookup_plugins/dnstxt.py
View file @
bd55899a
...
...
@@ -20,6 +20,7 @@ import os
HAVE_DNS
=
False
try
:
import
dns.resolver
from
dns.exception
import
DNSException
HAVE_DNS
=
True
except
ImportError
:
pass
...
...
@@ -43,9 +44,17 @@ class LookupModule(object):
domain
=
terms
.
split
()[
0
]
string
=
[]
answers
=
dns
.
resolver
.
query
(
domain
,
'TXT'
)
for
rdata
in
answers
:
s
=
rdata
.
to_text
()
string
.
append
(
s
[
1
:
-
1
])
# Strip outside quotes on TXT rdata
try
:
answers
=
dns
.
resolver
.
query
(
domain
,
'TXT'
)
for
rdata
in
answers
:
s
=
rdata
.
to_text
()
string
.
append
(
s
[
1
:
-
1
])
# Strip outside quotes on TXT rdata
except
dns
.
resolver
.
NXDOMAIN
:
string
=
'NXDOMAIN'
except
dns
.
resolver
.
Timeout
:
string
=
''
except
dns
.
exception
.
DNSException
as
e
:
raise
errors
.
AnsibleError
(
"dns.resolver unhandled exception"
,
e
)
return
''
.
join
(
string
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment