From 24cf56113580baac924529a5bd1993d501d891b5 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 29 Jan 2023 18:37:18 +0100 Subject: [PATCH] [PR #5913/451c9025 backport][stable-6] dig lookup: support CAA record type (#5917) dig lookup: support CAA record type (#5913) * Support CAA record type. * Update return docs. (cherry picked from commit 451c90251ad4b41e2f3b9a2c7e8bb557a1d5733f) Co-authored-by: Felix Fontein --- changelogs/fragments/5913-dig-caa.yml | 2 ++ plugins/lookup/dig.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/5913-dig-caa.yml diff --git a/changelogs/fragments/5913-dig-caa.yml b/changelogs/fragments/5913-dig-caa.yml new file mode 100644 index 0000000000..62ff698737 --- /dev/null +++ b/changelogs/fragments/5913-dig-caa.yml @@ -0,0 +1,2 @@ +minor_changes: + - "dig lookup plugin - support CAA record type (https://github.com/ansible-collections/community.general/pull/5913)." diff --git a/plugins/lookup/dig.py b/plugins/lookup/dig.py index ceaff15e9f..c3c209d303 100644 --- a/plugins/lookup/dig.py +++ b/plugins/lookup/dig.py @@ -35,9 +35,10 @@ DOCUMENTATION = ''' description: - Record type to query. - C(DLV) has been removed in community.general 6.0.0. + - C(CAA) has been added in community.general 6.3.0. type: str default: 'A' - choices: [A, ALL, AAAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT] + choices: [A, ALL, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT] flat: description: If 0 each record is returned as a dictionary, otherwise a string. type: int @@ -129,6 +130,12 @@ RETURN = """ AAAA: description: - address + CAA: + description: + - flags + - tag + - value + version_added: 6.3.0 CNAME: description: - target @@ -198,7 +205,7 @@ try: import dns.resolver import dns.reversename import dns.rdataclass - from dns.rdatatype import (A, AAAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, + from dns.rdatatype import (A, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT) HAVE_DNS = True except ImportError: @@ -218,6 +225,7 @@ def make_rdata_dict(rdata): supported_types = { A: ['address'], AAAA: ['address'], + CAA: ['flags', 'tag', 'value'], CNAME: ['target'], DNAME: ['target'], DNSKEY: ['flags', 'algorithm', 'protocol', 'key'],