From 0dcbb2c58231264c2f0a0374733b5e9cf8747e1f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2024 06:05:57 +0200 Subject: Merging upstream version 9.5.1+dfsg. Signed-off-by: Daniel Baumann --- .../dns/.github/workflows/ansible-test.yml | 8 +- .../community/dns/.github/workflows/docs-pr.yml | 1 + .../community/dns/.github/workflows/docs-push.yml | 1 + ansible_collections/community/dns/CHANGELOG.md | 362 +++++++++++---------- ansible_collections/community/dns/CHANGELOG.rst | 23 ++ ansible_collections/community/dns/FILES.json | 103 +++++- ansible_collections/community/dns/MANIFEST.json | 4 +- ansible_collections/community/dns/README.md | 4 +- .../community/dns/changelogs/changelog.yaml | 20 ++ .../community/dns/docs/docsite/config.yml | 7 + .../dns/docs/docsite/rst/filter_guide.rst | 5 + .../community/dns/plugins/filter/quote_txt.yml | 46 +++ .../community/dns/plugins/filter/txt.py | 47 +++ .../community/dns/plugins/filter/unquote_txt.yml | 42 +++ .../dns/plugins/plugin_utils/inventory/records.py | 3 +- .../community/dns/plugins/plugin_utils/unsafe.py | 41 +++ .../community/dns/plugins/public_suffix_list.dat | 211 ++++++++---- .../tests/integration/targets/filter_txt/aliases | 6 + .../integration/targets/filter_txt/tasks/main.yml | 49 +++ .../community/dns/tests/sanity/ignore-2.18.txt | 1 + .../dns/tests/sanity/ignore-2.18.txt.license | 3 + .../plugins/inventory/test_hetzner_dns_records.py | 72 +++- .../plugins/inventory/test_hosttech_dns_records.py | 76 ++++- .../dns/tests/unit/requirements-stable-2.10.txt | 2 +- 24 files changed, 880 insertions(+), 257 deletions(-) create mode 100644 ansible_collections/community/dns/docs/docsite/config.yml create mode 100644 ansible_collections/community/dns/plugins/filter/quote_txt.yml create mode 100644 ansible_collections/community/dns/plugins/filter/txt.py create mode 100644 ansible_collections/community/dns/plugins/filter/unquote_txt.yml create mode 100644 ansible_collections/community/dns/plugins/plugin_utils/unsafe.py create mode 100644 ansible_collections/community/dns/tests/integration/targets/filter_txt/aliases create mode 100644 ansible_collections/community/dns/tests/integration/targets/filter_txt/tasks/main.yml create mode 100644 ansible_collections/community/dns/tests/sanity/ignore-2.18.txt create mode 100644 ansible_collections/community/dns/tests/sanity/ignore-2.18.txt.license (limited to 'ansible_collections/community/dns') diff --git a/ansible_collections/community/dns/.github/workflows/ansible-test.yml b/ansible_collections/community/dns/.github/workflows/ansible-test.yml index 7ed813e13..186079a41 100644 --- a/ansible_collections/community/dns/.github/workflows/ansible-test.yml +++ b/ansible_collections/community/dns/.github/workflows/ansible-test.yml @@ -37,6 +37,7 @@ jobs: - stable-2.14 - stable-2.15 - stable-2.16 + - stable-2.17 - devel # Ansible-test on various stable branches does not yet work well with cgroups v2. # Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04 @@ -78,6 +79,7 @@ jobs: - stable-2.14 - stable-2.15 - stable-2.16 + - stable-2.17 - devel steps: @@ -111,7 +113,6 @@ jobs: ansible: - devel python: - - 3.7 - 3.8 - 3.9 - "3.10" @@ -150,6 +151,11 @@ jobs: python: "3.6" - ansible: stable-2.16 python: "3.11" + # 2.17 + - ansible: stable-2.17 + python: "3.7" + - ansible: stable-2.17 + python: "3.12" steps: - name: >- diff --git a/ansible_collections/community/dns/.github/workflows/docs-pr.yml b/ansible_collections/community/dns/.github/workflows/docs-pr.yml index cc71d2492..63c021d46 100644 --- a/ansible_collections/community/dns/.github/workflows/docs-pr.yml +++ b/ansible_collections/community/dns/.github/workflows/docs-pr.yml @@ -32,6 +32,7 @@ jobs: init-extra-html-theme-options: | documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/ render-file-line: '> * `$` [$](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$)' + extra-collections: community.library_inventory_filtering_v1 publish-docs-gh-pages: # for now we won't run this on forks diff --git a/ansible_collections/community/dns/.github/workflows/docs-push.yml b/ansible_collections/community/dns/.github/workflows/docs-push.yml index 85274e17d..f03ef77fb 100644 --- a/ansible_collections/community/dns/.github/workflows/docs-push.yml +++ b/ansible_collections/community/dns/.github/workflows/docs-push.yml @@ -37,6 +37,7 @@ jobs: init-html-short-title: Community.Dns Collection Docs init-extra-html-theme-options: | documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/ + extra-collections: community.library_inventory_filtering_v1 publish-docs-gh-pages: # for now we won't run this on forks diff --git a/ansible_collections/community/dns/CHANGELOG.md b/ansible_collections/community/dns/CHANGELOG.md index fbce77c60..9881ee7ed 100644 --- a/ansible_collections/community/dns/CHANGELOG.md +++ b/ansible_collections/community/dns/CHANGELOG.md @@ -2,188 +2,216 @@ **Topics** -- v2\.8\.3 +- v2\.9\.0 - Release Summary - Bugfixes -- v2\.8\.2 + - New Plugins + - Filter +- v2\.8\.3 - Release Summary - - Security Fixes - Bugfixes -- v2\.8\.1 +- v2\.8\.2 - Release Summary + - Security Fixes - Bugfixes -- v2\.8\.0 +- v2\.8\.1 - Release Summary - - Minor Changes - - Deprecated Features - Bugfixes -- v2\.7\.0 +- v2\.8\.0 - Release Summary - - Minor Changes + - Minor Changes + - Deprecated Features - Bugfixes -- v2\.6\.4 +- v2\.7\.0 - Release Summary + - Minor Changes - Bugfixes -- v2\.6\.3 +- v2\.6\.4 - Release Summary - Bugfixes -- v2\.6\.2 +- v2\.6\.3 - Release Summary - Bugfixes -- v2\.6\.1 +- v2\.6\.2 - Release Summary - Bugfixes -- v2\.6\.0 +- v2\.6\.1 - Release Summary - - Minor Changes - Bugfixes - - New Plugins +- v2\.6\.0 + - Release Summary + - Minor Changes + - Bugfixes + - New Plugins - Lookup - New Modules - v2\.5\.7 - - Release Summary - - Bugfixes -- v2\.5\.6 - Release Summary + - Bugfixes +- v2\.5\.6 + - Release Summary - Known Issues - v2\.5\.5 - - Release Summary - - Bugfixes -- v2\.5\.4 - Release Summary - Bugfixes -- v2\.5\.3 +- v2\.5\.4 - Release Summary - Bugfixes -- v2\.5\.2 +- v2\.5\.3 - Release Summary - Bugfixes -- v2\.5\.1 +- v2\.5\.2 - Release Summary - Bugfixes -- v2\.5\.0 +- v2\.5\.1 - Release Summary - - Minor Changes - - Deprecated Features - Bugfixes -- v2\.4\.2 +- v2\.5\.0 - Release Summary + - Minor Changes + - Deprecated Features - Bugfixes -- v2\.4\.1 +- v2\.4\.2 - Release Summary - Bugfixes -- v2\.4\.0 +- v2\.4\.1 - Release Summary - - Minor Changes - Bugfixes -- v2\.3\.4 +- v2\.4\.0 - Release Summary + - Minor Changes - Bugfixes -- v2\.3\.3 +- v2\.3\.4 - Release Summary - Bugfixes -- v2\.3\.2 +- v2\.3\.3 - Release Summary - Bugfixes -- v2\.3\.1 +- v2\.3\.2 - Release Summary - - Minor Changes - Bugfixes -- v2\.3\.0 +- v2\.3\.1 - Release Summary - - Minor Changes + - Minor Changes - Bugfixes -- v2\.2\.1 +- v2\.3\.0 - Release Summary + - Minor Changes - Bugfixes -- v2\.2\.0 +- v2\.2\.1 - Release Summary - - Minor Changes - Bugfixes -- v2\.1\.1 +- v2\.2\.0 - Release Summary + - Minor Changes - Bugfixes -- v2\.1\.0 +- v2\.1\.1 - Release Summary - - Minor Changes - Bugfixes -- v2\.0\.9 +- v2\.1\.0 - Release Summary + - Minor Changes - Bugfixes -- v2\.0\.8 +- v2\.0\.9 - Release Summary - Bugfixes -- v2\.0\.7 +- v2\.0\.8 - Release Summary - Bugfixes -- v2\.0\.6 +- v2\.0\.7 - Release Summary - Bugfixes -- v2\.0\.5 +- v2\.0\.6 - Release Summary - Bugfixes -- v2\.0\.4 +- v2\.0\.5 - Release Summary - Bugfixes -- v2\.0\.3 +- v2\.0\.4 - Release Summary + - Bugfixes +- v2\.0\.3 + - Release Summary - Minor Changes - v2\.0\.2 - - Release Summary - - Bugfixes -- v2\.0\.1 - Release Summary - Bugfixes -- v2\.0\.0 +- v2\.0\.1 - Release Summary + - Bugfixes +- v2\.0\.0 + - Release Summary - Minor Changes - Breaking Changes / Porting Guide - Deprecated Features - - Bugfixes - - New Plugins + - Bugfixes + - New Plugins - Inventory - New Modules - v1\.2\.0 - - Release Summary - - Minor Changes - - Bugfixes -- v1\.1\.0 - Release Summary - - Minor Changes + - Minor Changes - Bugfixes -- v1\.0\.1 +- v1\.1\.0 - Release Summary + - Minor Changes - Bugfixes -- v1\.0\.0 +- v1\.0\.1 - Release Summary - Bugfixes -- v0\.3\.0 +- v1\.0\.0 - Release Summary - - Minor Changes - Bugfixes +- v0\.3\.0 + - Release Summary + - Minor Changes + - Bugfixes - New Modules - v0\.2\.0 - - Release Summary + - Release Summary - Major Changes - Minor Changes - Breaking Changes / Porting Guide - - Bugfixes + - Bugfixes - New Modules - v0\.1\.0 - - Release Summary - - New Plugins - - Filter + - Release Summary + - New Plugins + - Filter - New Modules + +## v2\.9\.0 + + +### Release Summary + +Feature and bugfix release\. + + +### Bugfixes + +* Update Public Suffix List\. +* inventory plugins \- add unsafe wrapper to avoid marking strings that do not contain \{ or \} as unsafe\, to work around a bug in AWX \([https\://github\.com/ansible\-collections/community\.dns/pull/197](https\://github\.com/ansible\-collections/community\.dns/pull/197)\)\. + + +### New Plugins + + +#### Filter + +* community\.dns\.quote\_txt \- Quotes a string to use as a TXT record entry +* community\.dns\.unquote\_txt \- Unquotes a TXT record entry to a string + ## v2\.8\.3 - + ### Release Summary Bugfix release\. - + ### Bugfixes * DNS record modules\, inventory plugins \- fix the TXT entry encoder to avoid splitting up escape sequences for quotes and backslashes over multiple TXT strings \([https\://github\.com/ansible\-collections/community\.dns/issues/190](https\://github\.com/ansible\-collections/community\.dns/issues/190)\, [https\://github\.com/ansible\-collections/community\.dns/pull/191](https\://github\.com/ansible\-collections/community\.dns/pull/191)\)\. @@ -192,7 +220,7 @@ Bugfix release\. ## v2\.8\.2 - + ### Release Summary Bugfix release\. @@ -202,7 +230,7 @@ Bugfix release\. * hosttech\_dns\_records and hetzner\_dns\_records inventory plugins \- make sure all data received from the remote servers is marked as unsafe\, so remote code execution by obtaining texts that can be evaluated as templates is not possible \([https\://www\.die\-welt\.net/2024/03/remote\-code\-execution\-in\-ansible\-dynamic\-inventory\-plugins/](https\://www\.die\-welt\.net/2024/03/remote\-code\-execution\-in\-ansible\-dynamic\-inventory\-plugins/)\, [https\://github\.com/ansible\-collections/community\.dns/pull/189](https\://github\.com/ansible\-collections/community\.dns/pull/189)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -210,12 +238,12 @@ Bugfix release\. ## v2\.8\.1 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -223,7 +251,7 @@ Maintenance release with updated PSL\. ## v2\.8\.0 - + ### Release Summary Feature and maintenance release with updated PSL\. @@ -238,7 +266,7 @@ Feature and maintenance release with updated PSL\. * hetzner\_dns\_records and hosttech\_dns\_records inventory plugins \- the filters option has been renamed to simple\_filters\. The old name will stop working in community\.hrobot 2\.0\.0 \([https\://github\.com/ansible\-collections/community\.dns/pull/181](https\://github\.com/ansible\-collections/community\.dns/pull/181)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -246,7 +274,7 @@ Feature and maintenance release with updated PSL\. ## v2\.7\.0 - + ### Release Summary Bugfix and feature release with updated PSL\. @@ -257,7 +285,7 @@ Bugfix and feature release with updated PSL\. * nameserver\_info and nameserver\_record\_info \- add server parameter to specify custom DNS servers \([https\://github\.com/ansible\-collections/community\.dns/pull/168](https\://github\.com/ansible\-collections/community\.dns/pull/168)\, [https\://github\.com/ansible\-collections/community\.dns/pull/178](https\://github\.com/ansible\-collections/community\.dns/pull/178)\)\. * wait\_for\_txt \- add server parameter to specify custom DNS servers \([https\://github\.com/ansible\-collections/community\.dns/pull/178](https\://github\.com/ansible\-collections/community\.dns/pull/178)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -266,12 +294,12 @@ Bugfix and feature release with updated PSL\. ## v2\.6\.4 - + ### Release Summary Bugfix and maintenance version\. - + ### Bugfixes * Update Public Suffix List\. @@ -280,12 +308,12 @@ Bugfix and maintenance version\. ## v2\.6\.3 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * HTTP module utils \- make compatible with ansible\-core 2\.17 \([https\://github\.com/ansible\-collections/community\.dns/pull/165](https\://github\.com/ansible\-collections/community\.dns/pull/165)\)\. @@ -294,12 +322,12 @@ Maintenance release with updated PSL\. ## v2\.6\.2 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -307,12 +335,12 @@ Maintenance release with updated PSL\. ## v2\.6\.1 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -320,7 +348,7 @@ Maintenance release with updated PSL\. ## v2\.6\.0 - + ### Release Summary Feature release with an updated Public Suffix List\. @@ -331,13 +359,13 @@ Feature release with an updated Public Suffix List\. * wait\_for\_txt \- add servfail\_retries parameter that allows retrying after SERVFAIL errors \([https\://github\.com/ansible\-collections/community\.dns/pull/159](https\://github\.com/ansible\-collections/community\.dns/pull/159)\)\. * wait\_for\_txt\, resolver module utils \- use [EDNS](https\://en\.wikipedia\.org/wiki/Extension\_Mechanisms\_for\_DNS) \([https\://github\.com/ansible\-collections/community\.dns/pull/158](https\://github\.com/ansible\-collections/community\.dns/pull/158)\)\. - + ### Bugfixes * Update Public Suffix List\. * wait\_for\_txt\, resolver module utils \- improve error handling \([https\://github\.com/ansible\-collections/community\.dns/pull/158](https\://github\.com/ansible\-collections/community\.dns/pull/158)\)\. - + ### New Plugins @@ -355,12 +383,12 @@ Feature release with an updated Public Suffix List\. ## v2\.5\.7 - + ### Release Summary Regular maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -368,7 +396,7 @@ Regular maintenance release with updated Public Suffix List\. ## v2\.5\.6 - + ### Release Summary Maintenance release\. @@ -389,12 +417,12 @@ for the rendered HTML version of the documentation of the latest release\. ## v2\.5\.5 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -402,12 +430,12 @@ Maintenance release with updated PSL\. ## v2\.5\.4 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -415,12 +443,12 @@ Maintenance release with updated PSL\. ## v2\.5\.3 - + ### Release Summary Maintenance release with updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -428,12 +456,12 @@ Maintenance release with updated PSL\. ## v2\.5\.2 - + ### Release Summary Maintenance release with improved documentation and updated PSL\. - + ### Bugfixes * Update Public Suffix List\. @@ -441,12 +469,12 @@ Maintenance release with improved documentation and updated PSL\. ## v2\.5\.1 - + ### Release Summary Maintenance release \(updated PSL\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -454,7 +482,7 @@ Maintenance release \(updated PSL\)\. ## v2\.5\.0 - + ### Release Summary Feature and bugfix release with updated PSL\. @@ -470,7 +498,7 @@ Feature and bugfix release with updated PSL\. * The default of the newly added option txt\_character\_encoding will change from octal to decimal in community\.dns 3\.0\.0\. The new default will be compatible with [RFC 1035](https\://www\.ietf\.org/rfc/rfc1035\.txt) \([https\://github\.com/ansible\-collections/community\.dns/pull/134](https\://github\.com/ansible\-collections/community\.dns/pull/134)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -479,12 +507,12 @@ Feature and bugfix release with updated PSL\. ## v2\.4\.2 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -492,12 +520,12 @@ Maintenance release with updated Public Suffix List\. ## v2\.4\.1 - + ### Release Summary Regular maintenance release\. - + ### Bugfixes * Update Public Suffix List\. @@ -506,7 +534,7 @@ Regular maintenance release\. ## v2\.4\.0 - + ### Release Summary Feature and maintenance release\. @@ -518,7 +546,7 @@ Feature and maintenance release\. * Added a community\.dns\.hosttech module defaults group / action group\. Use with group/community\.dns\.hosttech to provide options for all Hosttech DNS modules \([https\://github\.com/ansible\-collections/community\.dns/pull/119](https\://github\.com/ansible\-collections/community\.dns/pull/119)\)\. * wait\_for\_txt \- the module now supports check mode\. The only practical change in behavior is that in check mode\, the module is now executed instead of skipped\. Since the module does not change anything\, it should have been marked as supporting check mode since it was originally added \([https\://github\.com/ansible\-collections/community\.dns/pull/119](https\://github\.com/ansible\-collections/community\.dns/pull/119)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -526,12 +554,12 @@ Feature and maintenance release\. ## v2\.3\.4 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -539,12 +567,12 @@ Maintenance release with updated Public Suffix List\. ## v2\.3\.3 - + ### Release Summary Maintenance release including an updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -552,12 +580,12 @@ Maintenance release including an updated Public Suffix List\. ## v2\.3\.2 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -565,7 +593,7 @@ Maintenance release with updated Public Suffix List\. ## v2\.3\.1 - + ### Release Summary Maintenance release including an updated Public Suffix List\. @@ -575,7 +603,7 @@ Maintenance release including an updated Public Suffix List\. * The collection repository conforms to the [REUSE specification](https\://reuse\.software/spec/) except for the changelog fragments \([https\://github\.com/ansible\-collections/community\.dns/pull/112](https\://github\.com/ansible\-collections/community\.dns/pull/112)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -583,7 +611,7 @@ Maintenance release including an updated Public Suffix List\. ## v2\.3\.0 - + ### Release Summary Maintenance release including an updated Public Suffix List\. @@ -593,7 +621,7 @@ Maintenance release including an updated Public Suffix List\. * All software licenses are now in the LICENSES/ directory of the collection root\. Moreover\, SPDX\-License\-Identifier\: is used to declare the applicable license for every file that is not automatically generated \([https\://github\.com/ansible\-collections/community\.dns/pull/109](https\://github\.com/ansible\-collections/community\.dns/pull/109)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -601,12 +629,12 @@ Maintenance release including an updated Public Suffix List\. ## v2\.2\.1 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -614,7 +642,7 @@ Maintenance release with updated Public Suffix List\. ## v2\.2\.0 - + ### Release Summary Feature release\. @@ -625,7 +653,7 @@ Feature release\. * hetzner\_dns\_records and hosttech\_dns\_records inventory plugins \- allow to template provider\-specific credentials and the zone\_name\, zone\_id options \([https\://github\.com/ansible\-collections/community\.dns/pull/106](https\://github\.com/ansible\-collections/community\.dns/pull/106)\)\. * wait\_for\_txt \- improve error messages so that in case of SERVFAILs or other DNS errors it is clear which record was queried from which DNS server \([https\://github\.com/ansible\-collections/community\.dns/pull/105](https\://github\.com/ansible\-collections/community\.dns/pull/105)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -633,12 +661,12 @@ Feature release\. ## v2\.1\.1 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -646,7 +674,7 @@ Maintenance release with updated Public Suffix List\. ## v2\.1\.0 - + ### Release Summary Feature and maintenance release with updated PSL\. @@ -656,7 +684,7 @@ Feature and maintenance release with updated PSL\. * Prepare collection for inclusion in an Execution Environment by declaring its dependencies \([https\://github\.com/ansible\-collections/community\.dns/pull/93](https\://github\.com/ansible\-collections/community\.dns/pull/93)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -664,12 +692,12 @@ Feature and maintenance release with updated PSL\. ## v2\.0\.9 - + ### Release Summary Maintenance release with updated Public Suffix List and added collection links file\. - + ### Bugfixes * Update Public Suffix List\. @@ -677,12 +705,12 @@ Maintenance release with updated Public Suffix List and added collection links f ## v2\.0\.8 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -690,12 +718,12 @@ Maintenance release with updated Public Suffix List\. ## v2\.0\.7 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -703,12 +731,12 @@ Maintenance release with updated Public Suffix List\. ## v2\.0\.6 - + ### Release Summary Bugfix release\. - + ### Bugfixes * Update Public Suffix List\. @@ -717,12 +745,12 @@ Bugfix release\. ## v2\.0\.5 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -730,12 +758,12 @@ Maintenance release with updated Public Suffix List\. ## v2\.0\.4 - + ### Release Summary Maintenance release with updated Public Suffix List\. - + ### Bugfixes * Update Public Suffix List\. @@ -743,7 +771,7 @@ Maintenance release with updated Public Suffix List\. ## v2\.0\.3 - + ### Release Summary Bugfix release\. @@ -756,12 +784,12 @@ Bugfix release\. ## v2\.0\.2 - + ### Release Summary Regular maintenance release\. - + ### Bugfixes * Update Public Suffix List\. @@ -769,12 +797,12 @@ Regular maintenance release\. ## v2\.0\.1 - + ### Release Summary Maintenance release with Public Suffix List updates\. - + ### Bugfixes * Update Public Suffix List\. @@ -782,7 +810,7 @@ Maintenance release with Public Suffix List updates\. ## v2\.0\.0 - + ### Release Summary This release contains many new features\, modules and plugins\, but also has several breaking changes to the 1\.x\.y versions\. Please read the changelog carefully to determine what to change if you used an earlier version of this collection\. @@ -822,7 +850,7 @@ This release contains many new features\, modules and plugins\, but also has sev * The hosttech\_dns\_records module has been renamed to hosttech\_dns\_record\_sets\. The old name will stop working in community\.dns 3\.0\.0 \([https\://github\.com/ansible\-collections/community\.dns/pull/31](https\://github\.com/ansible\-collections/community\.dns/pull/31)\)\. - + ### Bugfixes * Hetzner API \- interpret missing TTL as 300\, which is what the web console also does \([https\://github\.com/ansible\-collections/community\.dns/pull/42](https\://github\.com/ansible\-collections/community\.dns/pull/42)\)\. @@ -834,7 +862,7 @@ This release contains many new features\, modules and plugins\, but also has sev * wait\_for\_txt \- fix handling of too long TXT values \([https\://github\.com/ansible\-collections/community\.dns/pull/65](https\://github\.com/ansible\-collections/community\.dns/pull/65)\)\. * wait\_for\_txt \- resolving nameservers sometimes resulted in an empty list\, yielding wrong results \([https\://github\.com/ansible\-collections/community\.dns/pull/64](https\://github\.com/ansible\-collections/community\.dns/pull/64)\)\. - + ### New Plugins @@ -860,7 +888,7 @@ This release contains many new features\, modules and plugins\, but also has sev ## v1\.2\.0 - + ### Release Summary Last minor 1\.x\.0 version\. The 2\.0\.0 version will have some backwards incompatible changes to the hosttech\_dns\_record and hosttech\_dns\_records modules which will require user intervention\. These changes should result in a better UX\. @@ -872,7 +900,7 @@ Last minor 1\.x\.0 version\. The 2\.0\.0 version will have some backwards incomp * hosttech\_dns\_record \- in diff mode\, also return diff data structure when changed is false \([https\://github\.com/ansible\-collections/community\.dns/pull/28](https\://github\.com/ansible\-collections/community\.dns/pull/28)\)\. * module utils \- add default implementation for some zone/record API functions\, and move common JSON API code to helper class \([https\://github\.com/ansible\-collections/community\.dns/pull/26](https\://github\.com/ansible\-collections/community\.dns/pull/26)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -881,7 +909,7 @@ Last minor 1\.x\.0 version\. The 2\.0\.0 version will have some backwards incomp ## v1\.1\.0 - + ### Release Summary Regular maintenance release\. @@ -891,7 +919,7 @@ Regular maintenance release\. * Avoid internal ansible\-core module\_utils in favor of equivalent public API available since at least Ansible 2\.9 \([https\://github\.com/ansible\-collections/community\.dns/pull/24](https\://github\.com/ansible\-collections/community\.dns/pull/24)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -899,12 +927,12 @@ Regular maintenance release\. ## v1\.0\.1 - + ### Release Summary Regular maintenance release\. - + ### Bugfixes * Update Public Suffix List\. @@ -912,12 +940,12 @@ Regular maintenance release\. ## v1\.0\.0 - + ### Release Summary First stable release\. - + ### Bugfixes * Update Public Suffix List\. @@ -925,7 +953,7 @@ First stable release\. ## v0\.3\.0 - + ### Release Summary Fixes bugs\, adds rate limiting for Hosttech JSON API\, and adds a new bulk synchronization module\. @@ -935,7 +963,7 @@ Fixes bugs\, adds rate limiting for Hosttech JSON API\, and adds a new bulk sync * hosttech\_dns\_\* \- handle 419 Too Many Requests with proper rate limiting for JSON API \([https\://github\.com/ansible\-collections/community\.dns/pull/14](https\://github\.com/ansible\-collections/community\.dns/pull/14)\)\. - + ### Bugfixes * Avoid converting ASCII labels which contain underscores or other printable ASCII characters outside \[a\-zA\-Z0\-9\-\] to alabels during normalization \([https\://github\.com/ansible\-collections/community\.dns/pull/13](https\://github\.com/ansible\-collections/community\.dns/pull/13)\)\. @@ -949,7 +977,7 @@ Fixes bugs\, adds rate limiting for Hosttech JSON API\, and adds a new bulk sync ## v0\.2\.0 - + ### Release Summary Major refactoring release\, which adds a zone information module and supports HostTech\'s new REST API\. @@ -974,7 +1002,7 @@ Major refactoring release\, which adds a zone information module and supports Ho * hosttech\_\* module\_utils \- completely rewrite and refactor to support new JSON API and allow to reuse provider\-independent module logic \([https\://github\.com/ansible\-collections/community\.dns/pull/4](https\://github\.com/ansible\-collections/community\.dns/pull/4)\)\. - + ### Bugfixes * Update Public Suffix List\. @@ -989,15 +1017,15 @@ Major refactoring release\, which adds a zone information module and supports Ho ## v0\.1\.0 - + ### Release Summary Initial public release\. - + ### New Plugins - + #### Filter * community\.dns\.get\_public\_suffix \- Returns the public suffix of a DNS name diff --git a/ansible_collections/community/dns/CHANGELOG.rst b/ansible_collections/community/dns/CHANGELOG.rst index 37b4a2500..e91d83ebf 100644 --- a/ansible_collections/community/dns/CHANGELOG.rst +++ b/ansible_collections/community/dns/CHANGELOG.rst @@ -4,6 +4,29 @@ Community DNS Collection Release Notes .. contents:: Topics +v2.9.0 +====== + +Release Summary +--------------- + +Feature and bugfix release. + +Bugfixes +-------- + +- Update Public Suffix List. +- inventory plugins - add unsafe wrapper to avoid marking strings that do not contain ``{`` or ``}`` as unsafe, to work around a bug in AWX (https://github.com/ansible-collections/community.dns/pull/197). + +New Plugins +----------- + +Filter +~~~~~~ + +- community.dns.quote_txt - Quotes a string to use as a TXT record entry +- community.dns.unquote_txt - Unquotes a TXT record entry to a string + v2.8.3 ====== diff --git a/ansible_collections/community/dns/FILES.json b/ansible_collections/community/dns/FILES.json index 8bda06632..52b3239cd 100644 --- a/ansible_collections/community/dns/FILES.json +++ b/ansible_collections/community/dns/FILES.json @@ -25,7 +25,7 @@ "name": ".github/workflows/ansible-test.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cb9ff13908693ca232d8a96c732b37b686549b5a18c58241a40c14cafe97dec0", + "chksum_sha256": "4ef2a19d9715b2b9a70a6fe716ec40726b3c425f3c2b96d9bfe5d12489f74574", "format": 1 }, { @@ -39,14 +39,14 @@ "name": ".github/workflows/docs-pr.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fa2c8b94ec1355012d9b65d624ad400b327dfbb062cdc7407eb780a892524316", + "chksum_sha256": "dc9bab4e75bea6ee0b6887dd79d1f60ee31f938dc2b1992bfcd263cc623f290c", "format": 1 }, { "name": ".github/workflows/docs-push.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "88f3e91fc95a639fc831039a0503838f9850c51aedc52de0ef7adcfc7939ba4a", + "chksum_sha256": "005d031f01cb3322476bff7beec23f958cea6a2a9790e913771d40c360d2dcb2", "format": 1 }, { @@ -151,7 +151,7 @@ "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "86ce7da485fe12025925410c18b8b391fccc9b84dffff900037604813663277f", + "chksum_sha256": "d6afad220bd94bbf6ffd765666b7589d04b014238a3e02973e066958c44acf43", "format": 1 }, { @@ -193,7 +193,7 @@ "name": "docs/docsite/rst/filter_guide.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b407b72d65102202fc82d449bef8dd026f4d2debb9f7140fa6ac664a4cd4f5fc", + "chksum_sha256": "1af966088512f426e9ed72ce98dac4324fc02ddeafc33a0f70459b2c9bfe9ed7", "format": 1 }, { @@ -210,6 +210,13 @@ "chksum_sha256": "aa681fcb4d15501cb903fa73e3f12f587a094ccf38b4293cbc2f7c3c68fbb1d1", "format": 1 }, + { + "name": "docs/docsite/config.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0c5ec9ff76cf4db33b5d3f771419ef50d448e5d510cb7a98fc07dd9ecee69c4e", + "format": 1 + }, { "name": "docs/docsite/extra-docs.yml", "ftype": "file", @@ -378,6 +385,13 @@ "chksum_sha256": "2c48600982731c3de10e9a79bbe8bc3f067a86559de61934cd6eb9e97f58b402", "format": 1 }, + { + "name": "plugins/filter/quote_txt.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0539523d52bfbe0e0eb6b6d40a5e371fb4cc4705a3eab73eeb3c52198a74023b", + "format": 1 + }, { "name": "plugins/filter/remove_public_suffix.yml", "ftype": "file", @@ -392,6 +406,20 @@ "chksum_sha256": "fe3ad175b7092172931b942f83f4a449c1b7f4af1c77fa1baf3b07082911c534", "format": 1 }, + { + "name": "plugins/filter/txt.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1b6220db5e9ea678b67c1a5c31f60df50f6624c6cbd89e9531b95358f2675267", + "format": 1 + }, + { + "name": "plugins/filter/unquote_txt.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "58f2b5e0a6c736160a540b4ea3b7106465223d7c82c5480f71d3e39c7736c56e", + "format": 1 + }, { "name": "plugins/inventory", "ftype": "dir", @@ -802,7 +830,7 @@ "name": "plugins/plugin_utils/inventory/records.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c77b1d234e40d804759699724336db0683f6c9173f8e36c69b8b0e3d3a33a50c", + "chksum_sha256": "768ceedc4f0b624a22f9b777452f143e0b88639c1bd7e5f861d789ec0269e6e1", "format": 1 }, { @@ -833,11 +861,18 @@ "chksum_sha256": "513a321c0f6520841dec4c16a2e4fbaf993db51415526e253bb2dc0b190e2225", "format": 1 }, + { + "name": "plugins/plugin_utils/unsafe.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "93ccc2e18634405c7ff21a91a1df4f17261ac24b0f41bf3c46dbec2f254538c3", + "format": 1 + }, { "name": "plugins/public_suffix_list.dat", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9bf809262c4506519ef0c2d89681b77c8a87d2bcf5d17d7b0496840c1451cfd9", + "chksum_sha256": "27ae0b652366e8c5675942482de87819cf7947f5f4dc7bc661dc82b9b5da2d04", "format": 1 }, { @@ -959,6 +994,34 @@ "chksum_sha256": "92c856873b6b98a3a818dc09e1ba4cdd2e0e01449f1a28d6716eff605f1d2b01", "format": 1 }, + { + "name": "tests/integration/targets/filter_txt", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/filter_txt/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/filter_txt/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec0d81efcabab342ec8b892fdf9bcd54bf488a3b92a81a0efbe09f26e2d80c27", + "format": 1 + }, + { + "name": "tests/integration/targets/filter_txt/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92c856873b6b98a3a818dc09e1ba4cdd2e0e01449f1a28d6716eff605f1d2b01", + "format": 1 + }, { "name": "tests/integration/targets/hetzner", "ftype": "dir", @@ -1463,6 +1526,20 @@ "chksum_sha256": "6eb915239f9f35407fa68fdc41ed6522f1fdcce11badbdcd6057548023179ac1", "format": 1 }, + { + "name": "tests/sanity/ignore-2.18.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e6ba33006d3aa232443f145cbbc66c1eb5a4c06e75b6a9c63e89972c990d2786", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.18.txt.license", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6eb915239f9f35407fa68fdc41ed6522f1fdcce11badbdcd6057548023179ac1", + "format": 1 + }, { "name": "tests/sanity/ignore-2.9.txt", "ftype": "file", @@ -1502,14 +1579,14 @@ "name": "tests/unit/plugins/inventory/test_hetzner_dns_records.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b0a2245e3bc7a899c5ba90f7ea85471fa5f3c26aa612ac859e3cf0ede691ea44", + "chksum_sha256": "fcb263ece98ce1696cd5bbe594b86911d3365d9e8dfd9858ffbf6735c5dd46d2", "format": 1 }, { "name": "tests/unit/plugins/inventory/test_hosttech_dns_records.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c8c44d2037060fbfbaab8d05fc3af1d78513af2a5d91d872199aa75768a82b93", + "chksum_sha256": "20aafd958aa2e24b07b610c7d4efbee67cab74ecaada25876889564de7fe01d6", "format": 1 }, { @@ -1859,7 +1936,7 @@ "name": "tests/unit/requirements-stable-2.10.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1404c050017797dba43f1a8963794f33afaf0e5667abc792c062adf8ac84c254", + "chksum_sha256": "08f43f18582bbe66234f21183103b9c101b9f3a77248c8a27789283b9d6b4306", "format": 1 }, { @@ -1894,7 +1971,7 @@ "name": "CHANGELOG.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ab12a2e489b31f469f321b053a4cb432216fe20e8374cd0ffb4ecf68bc8c7348", + "chksum_sha256": "bc56ad1ca72650697ca9f41b004a70f54ef329c79938268b1430d0dac8fa51d6", "format": 1 }, { @@ -1908,7 +1985,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a2deefeaf4feaee535b1f34f517495188be0c31c22c1e5a33e470f86245dc92f", + "chksum_sha256": "6dd1dbacede2c19ab983288d1fccde3d6369642593b1da10029cdf53e6b3176c", "format": 1 }, { @@ -1936,7 +2013,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9083e4932c4b72abbc6c7382b3c964df7826b1a12a49f4d2e34cc36155380fd7", + "chksum_sha256": "61615f641d8efd57833806770c66a86dfe2ceb595df9fe1e9ef1fc0d9e2bfab4", "format": 1 }, { diff --git a/ansible_collections/community/dns/MANIFEST.json b/ansible_collections/community/dns/MANIFEST.json index fcbfda5d6..0c60fe528 100644 --- a/ansible_collections/community/dns/MANIFEST.json +++ b/ansible_collections/community/dns/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "community", "name": "dns", - "version": "2.8.3", + "version": "2.9.0", "authors": [ "Felix Fontein (github.com/felixfontein)", "Markus Bergholz (github.com/markuman)" @@ -30,7 +30,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8234c71782176e94860f305e6a9e4365b2167e2bd47e59e9c580a1011fc96b39", + "chksum_sha256": "723a758354360ce388c0f83a88527e05dc67d3bcad6495e66deca44b8a169d12", "format": 1 }, "format": 1 diff --git a/ansible_collections/community/dns/README.md b/ansible_collections/community/dns/README.md index 8a404fa3a..32257a110 100644 --- a/ansible_collections/community/dns/README.md +++ b/ansible_collections/community/dns/README.md @@ -16,7 +16,7 @@ Please note that this collection does **not** support Windows targets. ## Tested with Ansible -Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, ansible-core 2.15, and ansible-core 2.16 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported. +Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, ansible-core 2.15, ansible-core 2.16, and ansible-core 2.17 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported. ## External requirements @@ -61,6 +61,8 @@ If you use the Ansible package and do not update collections independently, use - `get_registrable_domain`: given a domain name, returns the *registrable domain name* (also called *registered domain name*). For example, `"www.ansible.com" | community.dns.get_registrable_domain == "ansible.com"` and `"some.random.prefixes.ansible.co.uk" | community.dns.get_registrable_domain == "ansible.co.uk"`. - `remove_public_suffix`: given a domain name, returns the part before the public suffix. For example, `"www.ansible.com" | community.dns.remove_public_suffix == "www.ansible"` and `"some.random.prefixes.ansible.co.uk" | community.dns.remove_public_suffix == "some.random.prefixes.ansible"`. - `remove_registrable_domain`: given a domain name, returns the part before the DNS zone. For example, `"www.ansible.com" | community.dns.remove_registrable_domain == "www"` and `"some.random.prefixes.ansible.co.uk" | community.dns.remove_registrable_domain == "some.random.prefixes"`. + - `quote_txt`: quotes a string for use as a TXT record entry. For example, `"this is a test" | community.dns.quote_txt == '"this is a test"'`. + - `unquote_txt`: unquotes a TXT record entry. For example, `'"foo" "bar"' | community.dns.unquote_txt == "foobar"`. ## Using this collection diff --git a/ansible_collections/community/dns/changelogs/changelog.yaml b/ansible_collections/community/dns/changelogs/changelog.yaml index 626ad4abf..3eafad115 100644 --- a/ansible_collections/community/dns/changelogs/changelog.yaml +++ b/ansible_collections/community/dns/changelogs/changelog.yaml @@ -809,3 +809,23 @@ releases: - 2.8.3.yml - update-psl.yml release_date: '2024-03-24' + 2.9.0: + changes: + bugfixes: + - Update Public Suffix List. + - inventory plugins - add unsafe wrapper to avoid marking strings that do not + contain ``{`` or ``}`` as unsafe, to work around a bug in AWX (https://github.com/ansible-collections/community.dns/pull/197). + release_summary: Feature and bugfix release. + fragments: + - 197-unsafe.yml + - 3.9.0.yml + - update-psl.yml + plugins: + filter: + - description: Quotes a string to use as a TXT record entry + name: quote_txt + namespace: null + - description: Unquotes a TXT record entry to a string + name: unquote_txt + namespace: null + release_date: '2024-04-21' diff --git a/ansible_collections/community/dns/docs/docsite/config.yml b/ansible_collections/community/dns/docs/docsite/config.yml new file mode 100644 index 000000000..1d6cf8554 --- /dev/null +++ b/ansible_collections/community/dns/docs/docsite/config.yml @@ -0,0 +1,7 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +changelog: + write_changelog: true diff --git a/ansible_collections/community/dns/docs/docsite/rst/filter_guide.rst b/ansible_collections/community/dns/docs/docsite/rst/filter_guide.rst index aee397f8a..5643b2b4e 100644 --- a/ansible_collections/community/dns/docs/docsite/rst/filter_guide.rst +++ b/ansible_collections/community/dns/docs/docsite/rst/filter_guide.rst @@ -23,6 +23,11 @@ These filters allow to work with `public suffixes +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + +from ansible.errors import AnsibleFilterError +from ansible.module_utils.common.text.converters import to_text +from ansible.module_utils.six import string_types + +from ansible_collections.community.dns.plugins.module_utils.conversion.txt import ( + decode_txt_value, + encode_txt_value, +) + + +def quote_txt(value, always_quote=False, character_encoding='decimal'): + if not isinstance(value, string_types): + raise AnsibleFilterError('Input for community.dns.quote_txt must be a string') + if not isinstance(always_quote, bool): + raise AnsibleFilterError('always_quote must be a boolean, not {value!r}'.format(value=always_quote)) + if character_encoding not in ('decimal', 'octal'): + raise AnsibleFilterError('character_encoding must be "decimal" or "octal", not {value!r}'.format(value=character_encoding)) + value = to_text(value) + return encode_txt_value(value, always_quote=always_quote, character_encoding=character_encoding) + + +def unquote_txt(value, character_encoding='decimal'): + if not isinstance(value, string_types): + raise AnsibleFilterError('Input for community.dns.unquote_txt must be a string') + if character_encoding not in ('decimal', 'octal'): + raise AnsibleFilterError('character_encoding must be "decimal" or "octal", not {value!r}'.format(value=character_encoding)) + value = to_text(value) + return decode_txt_value(value, character_encoding=character_encoding) + + +class FilterModule(object): + '''Ansible jinja2 filters''' + + def filters(self): + return { + 'quote_txt': quote_txt, + 'unquote_txt': unquote_txt, + } diff --git a/ansible_collections/community/dns/plugins/filter/unquote_txt.yml b/ansible_collections/community/dns/plugins/filter/unquote_txt.yml new file mode 100644 index 000000000..712cf3ad4 --- /dev/null +++ b/ansible_collections/community/dns/plugins/filter/unquote_txt.yml @@ -0,0 +1,42 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +DOCUMENTATION: + name: unquote_txt + short_description: Unquotes a TXT record entry to a string + version_added: 2.9.0 + description: + - Given a (quoted) TXT entry content, extracts its value. + options: + _input: + description: + - The string to unquote. + type: string + required: true + character_encoding: + description: + - Whether to treat numeric escape sequences (V(\\xyz)) as octal or decimal numbers. + - The default value V(decimal) is compatible to L(RFC 1035, https://www.ietf.org/rfc/rfc1035.txt). + type: str + default: decimal + choices: + - decimal + - octal + author: + - Felix Fontein (@felixfontein) + +EXAMPLES: | + - name: Unquote a TXT entry + ansible.builtin.set_fact: + public_suffix: "{{ value | community.dns.unquote_txt }}" + # Should result in 'this is a test' + vars: + value: >- + "this is " "a test" + +RETURN: + _value: + description: The extracted string. + type: string diff --git a/ansible_collections/community/dns/plugins/plugin_utils/inventory/records.py b/ansible_collections/community/dns/plugins/plugin_utils/inventory/records.py index 30fa11bdc..1d6827f2f 100644 --- a/ansible_collections/community/dns/plugins/plugin_utils/inventory/records.py +++ b/ansible_collections/community/dns/plugins/plugin_utils/inventory/records.py @@ -15,7 +15,6 @@ from ansible.module_utils import six from ansible.module_utils.common._collections_compat import Sequence from ansible.plugins.inventory import BaseInventoryPlugin from ansible.utils.display import Display -from ansible.utils.unsafe_proxy import wrap_var as make_unsafe from ansible.template import Templar from ansible_collections.community.dns.plugins.module_utils.provider import ( @@ -35,6 +34,8 @@ from ansible_collections.community.dns.plugins.module_utils.conversion.converter RecordConverter, ) +from ansible_collections.community.dns.plugins.plugin_utils.unsafe import make_unsafe + display = Display() diff --git a/ansible_collections/community/dns/plugins/plugin_utils/unsafe.py b/ansible_collections/community/dns/plugins/plugin_utils/unsafe.py new file mode 100644 index 000000000..1eb61bea0 --- /dev/null +++ b/ansible_collections/community/dns/plugins/plugin_utils/unsafe.py @@ -0,0 +1,41 @@ +# Copyright (c) 2023, Felix Fontein +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import re + +from ansible.module_utils.six import binary_type, text_type +from ansible.module_utils.common._collections_compat import Mapping, Set +from ansible.module_utils.common.collections import is_sequence +from ansible.utils.unsafe_proxy import ( + AnsibleUnsafe, + wrap_var as _make_unsafe, +) + +_RE_TEMPLATE_CHARS = re.compile(u'[{}]') +_RE_TEMPLATE_CHARS_BYTES = re.compile(b'[{}]') + + +def make_unsafe(value): + if value is None or isinstance(value, AnsibleUnsafe): + return value + + if isinstance(value, Mapping): + return dict((make_unsafe(key), make_unsafe(val)) for key, val in value.items()) + elif isinstance(value, Set): + return set(make_unsafe(elt) for elt in value) + elif is_sequence(value): + return type(value)(make_unsafe(elt) for elt in value) + elif isinstance(value, binary_type): + if _RE_TEMPLATE_CHARS_BYTES.search(value): + value = _make_unsafe(value) + return value + elif isinstance(value, text_type): + if _RE_TEMPLATE_CHARS.search(value): + value = _make_unsafe(value) + return value + + return value diff --git a/ansible_collections/community/dns/plugins/public_suffix_list.dat b/ansible_collections/community/dns/plugins/public_suffix_list.dat index dd8bd923e..125f1e3d7 100644 --- a/ansible_collections/community/dns/plugins/public_suffix_list.dat +++ b/ansible_collections/community/dns/plugins/public_suffix_list.dat @@ -6710,7 +6710,7 @@ org.zw // newGTLDs -// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2024-03-06T15:14:58Z +// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2024-03-28T15:13:37Z // This list is auto-generated, don't edit it manually. // aaa : American Automobile Association, Inc. // https://www.iana.org/domains/root/db/aaa.html @@ -6988,10 +6988,6 @@ auto // https://www.iana.org/domains/root/db/autos.html autos -// avianca : Avianca Inc. -// https://www.iana.org/domains/root/db/avianca.html -avianca - // aws : AWS Registry LLC // https://www.iana.org/domains/root/db/aws.html aws @@ -12080,6 +12076,7 @@ autocode.dev // AVM : https://avm.de // Submitted by Andreas Weise +myfritz.link myfritz.net // AVStack Pte. Ltd. : https://avstack.io @@ -12357,6 +12354,12 @@ pages.dev r2.dev workers.dev +// cloudscale.ch AG : https://www.cloudscale.ch/ +// Submitted by Gaudenz Steinlin +cust.cloudscale.ch +objects.lpg.cloudscale.ch +objects.rma.cloudscale.ch + // Clovyr : https://clovyr.io // Submitted by Patrick Nielsen wnext.app @@ -12374,22 +12377,33 @@ co.cz // CDN77.com : http://www.cdn77.com // Submitted by Jan Krpes -c.cdn77.org +cdn77-storage.com +rsc.contentproxy9.cz cdn77-ssl.net r.cdn77.net -rsc.cdn77.org ssl.origin.cdn77-secure.org +c.cdn77.org +rsc.cdn77.org // Cloud DNS Ltd : http://www.cloudns.net -// Submitted by Aleksander Hristov +// Submitted by Aleksander Hristov & Boyan Peychev cloudns.asia +cloudns.be cloudns.biz -cloudns.club cloudns.cc +cloudns.ch +cloudns.cl +cloudns.club +dnsabr.com +cloudns.cx cloudns.eu cloudns.in cloudns.info +dns-cloud.net +dns-dynamic.net +cloudns.nz cloudns.org +cloudns.ph cloudns.pro cloudns.pw cloudns.us @@ -12402,6 +12416,11 @@ cnpy.gdn // Submitted by Moritz Marquardt codeberg.page +// CodeSandbox B.V. : https://codesandbox.io +// Submitted by Ives van Hoorne +csb.app +preview.csb.app + // CoDNS B.V. co.nl co.no @@ -12520,6 +12539,7 @@ dyndns.dappnode.io // Dark, Inc. : https://darklang.com // Submitted by Paul Biggar builtwithdark.com +darklang.io // DataDetect, LLC. : https://datadetect.com // Submitted by Andrew Banchich @@ -12918,6 +12938,10 @@ ondigitalocean.app // Submitted by Robin H. Johnson *.digitaloceanspaces.com +// DigitalPlat : https://www.digitalplat.org/ +// Submitted by Edward Hsing +us.kg + // dnstrace.pro : https://dnstrace.pro/ // Submitted by Chris Partridge bci.dnstrace.pro @@ -12959,6 +12983,14 @@ easypanel.host // Submitted by *.ewp.live +// Electromagnetic Field : https://www.emfcamp.org +// Submitted by +at.emf.camp + +// Elefunc, Inc. : https://elefunc.com +// Submitted by Cetin Sert +rt.ht + // Elementor : Elementor Ltd. // Submitted by Anton Barkan elementor.cloud @@ -13250,7 +13282,8 @@ forgeblocks.com id.forgerock.io // Framer : https://www.framer.com -// Submitted by Koen Rouwhorst +// Submitted by Koen Rouwhorst +framer.ai framer.app framercanvas.com framer.media @@ -13291,6 +13324,24 @@ freemyip.com // Submitted by Daniel A. Maierhofer wien.funkfeuer.at +// Future Versatile Group. :https://www.fvg-on.net/ +// T.Kabu +daemon.asia +dix.asia +mydns.bz +0am.jp +0g0.jp +0j0.jp +0t0.jp +mydns.jp +pgw.jp +wjg.jp +keyword-on.net +live-on.net +server-on.net +mydns.tw +mydns.vc + // Futureweb GmbH : https://www.futureweb.at // Submitted by Andreas Schnederle-Wagner *.futurecms.at @@ -13334,6 +13385,12 @@ gentlentapis.com lab.ms cdn-edges.net +// Getlocalcert: https://www.getlocalcert.net +// Submitted by Robert Alexander +localcert.net +localhostcert.net +corpnet.work + // Ghost Foundation : https://ghost.org // Submitted by Matt Hanley ghost.io @@ -13480,6 +13537,10 @@ whitesnow.jp zombie.jp heteml.net +// GoDaddy Registry : https://registry.godaddy +// Submitted by Rohan Durrant +graphic.design + // GOV.UK Platform as a Service : https://www.cloud.service.gov.uk/ // Submitted by Tom Whitwell cloudapps.digital @@ -13599,6 +13660,10 @@ goupile.fr // Submitted by gov.nl +// GrayJay Web Solutions Inc. : https://grayjaysports.ca +// Submitted by Matt Yamkowy +grayjayleagues.com + // Group 53, LLC : https://www.group53.com // Submitted by Tyler Todd awsmppl.com @@ -13633,6 +13698,11 @@ hasura-app.io // Submitted by Richard Zowalla pages.it.hs-heilbronn.de +// Helio Networks : https://heliohost.org +// Submitted by Ben Frede +helioho.st +heliohost.us + // Hepforge : https://www.hepforge.org // Submitted by David Grellscheid hepforge.org @@ -13646,7 +13716,6 @@ herokussl.com // Submitted by Oren Eini ravendb.cloud ravendb.community -ravendb.me development.run ravendb.run @@ -13737,7 +13806,7 @@ biz.at info.at // info.cx : http://info.cx -// Submitted by Jacob Slater +// Submitted by June Slater info.cx // Interlegis : http://www.interlegis.leg.br @@ -13786,6 +13855,14 @@ iopsys.se // Submitted by Matthew Hardeman ipifony.net +// is-a.dev : https://www.is-a.dev +// Submitted by William Harrison +is-a.dev + +// ir.md : https://nic.ir.md +// Submitted by Ali Soizi +ir.md + // IServ GmbH : https://iserv.de // Submitted by Mario Hoberg iservschule.de @@ -13894,6 +13971,11 @@ myjino.ru // Submitted by Daniel Fariña jotelulu.cloud +// JouwWeb B.V. : https://www.jouwweb.nl +// Submitted by Camilo Sperberg +jouwweb.site +webadorsite.com + // Joyent : https://www.joyent.com/ // Submitted by Brian Bennett *.triton.zone @@ -13967,6 +14049,10 @@ lpusercontent.com // Submitted by Lelux Admin lelux.site +// Libre IT Ltd : https://libre.nz +// Submitted by Tomas Maggio +runcontainers.dev + // Lifetime Hosting : https://Lifetime.Hosting/ // Submitted by Mike Fillator co.business @@ -14141,7 +14227,6 @@ co.pl // Managed by Corporate Domains // Microsoft Azure : https://home.azure *.azurecontainer.io -cloudapp.azure.com azure-api.net azureedge.net azurefd.net @@ -14248,13 +14333,18 @@ ngrok.pro torun.pl // Nimbus Hosting Ltd. : https://www.nimbushosting.co.uk/ -// Submitted by Nicholas Ford +// Submitted by Nicholas Ford nh-serv.co.uk +nimsite.uk // NFSN, Inc. : https://www.NearlyFreeSpeech.NET/ // Submitted by Jeff Wheelhouse nfshost.com +// NFT.Storage : https://nft.storage/ +// Submitted by Vasco Santos or +ipfs.nftstorage.link + // Noop : https://noop.app // Submitted by Nathaniel Schweinberg *.developer.app @@ -14434,7 +14524,6 @@ omniwe.site 123minsida.se 123miweb.es 123paginaweb.pt -123sait.ru 123siteweb.fr 123webseite.at 123webseite.de @@ -14452,6 +14541,13 @@ simplesite.pl // Submitted by Eddie Jones nid.io +// Open Domains : https://open-domains.net +// Submitted by William Harrison +is-cool.dev +is-not-a.dev +localplayer.dev +is-local.org + // Open Social : https://www.getopensocial.com/ // Submitted by Alexander Varwijk opensocial.site @@ -14472,6 +14568,11 @@ operaunite.com // Submitted by Alexandre Linte tech.orange +// OsSav Technology Ltd. : https://ossav.com/ +// TLD Nic: http://nic.can.re - TLD Whois Server: whois.can.re +// Submitted by OsSav Technology Ltd. +can.re + // Oursky Limited : https://authgear.com/, https://skygear.io/ // Submitted by Authgear Team , Skygear Developer authgear-staging.com @@ -14522,10 +14623,10 @@ pagexl.com // pcarrier.ca Software Inc: https://pcarrier.ca/ // Submitted by Pierre Carrier -bar0.net -bar1.net -bar2.net -rdv.to +*.xmit.co +srv.us +gh.srv.us +gl.srv.us // .pl domains (grandfathered) art.pl @@ -14683,9 +14784,12 @@ qcx.io *.sys.qcx.io // QNAP System Inc : https://www.qnap.com -// Submitted by Nick Chang -dev-myqnapcloud.com +// Submitted by Nick Chang +myqnapcloud.cn alpha-myqnapcloud.com +dev-myqnapcloud.com +mycloudnas.com +mynascloud.com myqnapcloud.com // Quip : https://quip.com @@ -14915,6 +15019,10 @@ service.gov.scot // Submitted by Shante Adam scrysec.com +// Scrypted : https://scrypted.app +// Submitted by Koushik Dutta +client.scrypted.io + // Securepoint GmbH : https://www.securepoint.de // Submitted by Erik Anders firewall-gateway.com @@ -15024,9 +15132,9 @@ small-web.org vp4.me // Snowflake Inc : https://www.snowflake.com/ -// Submitted by Faith Olapade -snowflake.app -privatelink.snowflake.app +// Submitted by Sam Haar +*.snowflake.app +*.privatelink.snowflake.app streamlit.app streamlitapp.com @@ -15038,6 +15146,12 @@ try-snowplow.com // Submitted by Drew DeVault srht.site +// StackBlitz : https://stackblitz.com +// Submitted by Dominic Elm +w-corp-staticblitz.com +w-credentialless-staticblitz.com +w-staticblitz.com + // Stackhero : https://www.stackhero.io // Submitted by Adrien Gillon stackhero-network.com @@ -15339,6 +15453,10 @@ inc.hk // Submitted by ITComdomains it.com +// Unison Computing, PBC : https://unison.cloud +// Submitted by Simon Højberg +unison-services.cloud + // UNIVERSAL DOMAIN REGISTRY : https://www.udr.org.yt/ // see also: whois -h whois.udr.org.yt help // Submitted by Atanunu Igbunuroghene @@ -15388,47 +15506,6 @@ v-info.info // Submitted by Nathan van Bakel voorloper.cloud -// Voxel.sh DNS : https://voxel.sh/dns/ -// Submitted by Mia Rehlinger -neko.am -nyaa.am -be.ax -cat.ax -es.ax -eu.ax -gg.ax -mc.ax -us.ax -xy.ax -nl.ci -xx.gl -app.gp -blog.gt -de.gt -to.gt -be.gy -cc.hn -io.kg -jp.kg -tv.kg -uk.kg -us.kg -de.ls -at.md -de.md -jp.md -to.md -indie.porn -vxl.sh -ch.tc -me.tc -we.tc -nyan.to -at.vg -blog.vu -dev.vu -me.vu - // V.UA Domain Administrator : https://domain.v.ua/ // Submitted by Serhii Rostilo v.ua @@ -15457,6 +15534,10 @@ reserve-online.com bookonline.app hotelwithflight.com +// WebWaddle Ltd: https://webwaddle.com/ +// Submitted by Merlin Glander +*.wadl.top + // WeDeploy by Liferay, Inc. : https://www.wedeploy.com // Submitted by Henrique Vicente wedeploy.io diff --git a/ansible_collections/community/dns/tests/integration/targets/filter_txt/aliases b/ansible_collections/community/dns/tests/integration/targets/filter_txt/aliases new file mode 100644 index 000000000..b7419a24d --- /dev/null +++ b/ansible_collections/community/dns/tests/integration/targets/filter_txt/aliases @@ -0,0 +1,6 @@ +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +shippable/posix/group1 +skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller diff --git a/ansible_collections/community/dns/tests/integration/targets/filter_txt/tasks/main.yml b/ansible_collections/community/dns/tests/integration/targets/filter_txt/tasks/main.yml new file mode 100644 index 000000000..c0afffcea --- /dev/null +++ b/ansible_collections/community/dns/tests/integration/targets/filter_txt/tasks/main.yml @@ -0,0 +1,49 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +- name: "Test quote_txt filter" + assert: + that: + - >- + '' | community.dns.quote_txt == '""' + - >- + "this is a test" | community.dns.quote_txt == '"this is a test"' + - >- + "test" | community.dns.quote_txt == 'test' + - >- + "test" | community.dns.quote_txt(always_quote=true) == '"test"' + - >- + '"' | community.dns.quote_txt == '\\"' + - >- + ' ' | community.dns.quote_txt == '" "' + - >- + "ä" | community.dns.quote_txt() == '\\195\\164' + - >- + "ä" | community.dns.quote_txt(character_encoding='octal') == '\\303\\244' + - >- + "ä" | community.dns.quote_txt(character_encoding='octal', always_quote=true) == '"\\303\\244"' + - >- + very_long_input | community.dns.quote_txt == very_long_output + vars: + very_long_input: >- + this is a very1, very2, very3, very4, very5, very6, very7, very8, very9, very10, very11, very12, very13, very14, very15, + very16, very17, very18, very19, very20, very21, very22, very23, very24, very25, very26, very27, very28, very29, very30, + very31, very32, very33, very34, very35, very36, very37, very38, very39 long text + very_long_output: >- + "this is a very1, very2, very3, very4, very5, very6, very7, very8, very9, very10, very11, very12, very13, very14, very15, + very16, very17, very18, very19, very20, very21, very22, very23, very24, very25, very26, very27, very28, very29, very30, + very31, very32" ", very33, very34, very35, very36, very37, very38, very39 long text" + +- name: "Test unquote_txt filter" + assert: + that: + - >- + '' | community.dns.unquote_txt == '' + - >- + '""' | community.dns.unquote_txt == '' + - > + '"foo" "bar"' | community.dns.unquote_txt == "foobar" + - > + 'foo "bar baz" bam' | community.dns.unquote_txt == "foobar bazbam" diff --git a/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt b/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt new file mode 100644 index 000000000..dc9da1161 --- /dev/null +++ b/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt @@ -0,0 +1 @@ +plugins/public_suffix_list.dat no-smart-quotes diff --git a/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt.license b/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt.license new file mode 100644 index 000000000..edff8c768 --- /dev/null +++ b/ansible_collections/community/dns/tests/sanity/ignore-2.18.txt.license @@ -0,0 +1,3 @@ +GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +SPDX-License-Identifier: GPL-3.0-or-later +SPDX-FileCopyrightText: Ansible Project diff --git a/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hetzner_dns_records.py b/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hetzner_dns_records.py index bfaa4886d..44f694708 100644 --- a/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hetzner_dns_records.py +++ b/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hetzner_dns_records.py @@ -108,6 +108,68 @@ HETZNER_JSON_DEFAULT_ENTRIES = [ }, ] +HETZNER_JSON_DEFAULT_ENTRIES_UNSAFE = [ + { + 'id': '125', + 'type': 'A', + 'name': '@', + 'value': '1.2.{3.4', + 'ttl': 3600, + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, + { + 'id': '126', + 'type': 'A', + 'name': '*', + 'value': '1.2.{3.5', + 'ttl': 3600, + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, + { + 'id': '127', + 'type': 'AAAA', + 'name': '@', + 'value': '2001:1:2::{3', + 'ttl': 3600, + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, + { + 'id': '128', + 'type': 'AAAA', + 'name': 'foo', + 'value': '2001:1:2::{4', + 'ttl': 3600, + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, + { + 'id': '129', + 'type': 'MX', + 'name': '@', + 'value': '10 example.com', + 'ttl': 3600, + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, + { + 'id': '130', + 'type': 'CNAME', + 'name': 'bar', + 'value': 'example.org.', + 'zone_id': '42', + 'created': '2021-07-09T11:18:37Z', + 'modified': '2021-07-09T11:18:37Z', + }, +] + HETZNER_JSON_BAD_ENTRIES = [ { 'id': '125', @@ -135,6 +197,10 @@ HETZNER_JSON_ZONE_RECORDS_GET_RESULT = { 'records': HETZNER_JSON_DEFAULT_ENTRIES, } +HETZNER_JSON_ZONE_RECORDS_GET_RESULT_UNSAFE = { + 'records': HETZNER_JSON_DEFAULT_ENTRIES_UNSAFE, +} + HETZNER_JSON_ZONE_RECORDS_GET_RESULT_2 = { 'records': HETZNER_JSON_BAD_ENTRIES, } @@ -190,7 +256,7 @@ def test_inventory_file_simple(mocker): .expect_query_values('page', '1') .expect_query_values('per_page', '100') .return_header('Content-Type', 'application/json') - .result_json(HETZNER_JSON_ZONE_RECORDS_GET_RESULT), + .result_json(HETZNER_JSON_ZONE_RECORDS_GET_RESULT_UNSAFE), ]) mocker.patch('ansible_collections.community.dns.plugins.module_utils.http.open_url', open_url) mocker.patch('ansible.inventory.manager.unfrackpath', mock_unfrackpath_noop) @@ -207,8 +273,8 @@ def test_inventory_file_simple(mocker): assert 'bar.example.com' not in im._inventory.hosts assert im._inventory.get_host('example.com') in im._inventory.groups['ungrouped'].hosts assert im._inventory.get_host('*.example.com') in im._inventory.groups['ungrouped'].hosts - assert im._inventory.get_host('example.com').get_vars()['ansible_host'] == '1.2.3.4' - assert im._inventory.get_host('*.example.com').get_vars()['ansible_host'] == '1.2.3.5' + assert im._inventory.get_host('example.com').get_vars()['ansible_host'] == '1.2.{3.4' + assert im._inventory.get_host('*.example.com').get_vars()['ansible_host'] == '1.2.{3.5' assert isinstance(im._inventory.get_host('example.com').get_vars()['ansible_host'], AnsibleUnsafe) assert isinstance(im._inventory.get_host('*.example.com').get_vars()['ansible_host'], AnsibleUnsafe) assert len(im._inventory.groups['ungrouped'].hosts) == 2 diff --git a/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hosttech_dns_records.py b/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hosttech_dns_records.py index cefd02a06..11995198c 100644 --- a/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hosttech_dns_records.py +++ b/ansible_collections/community/dns/tests/unit/plugins/inventory/test_hosttech_dns_records.py @@ -89,6 +89,64 @@ HOSTTECH_JSON_DEFAULT_ENTRIES = [ }, ] +HOSTTECH_JSON_DEFAULT_ENTRIES_UNSAFE = [ + # (125, 42, 'A', '', '1.2.{3.4', 3600, None, None), + { + 'id': 125, + 'type': 'A', + 'name': '', + 'ipv4': '1.2.{3.4', + 'ttl': 3600, + 'comment': '', + }, + # (126, 42, 'A', '*', '1.2.{3.5', 3600, None, None), + { + 'id': 126, + 'type': 'A', + 'name': '*', + 'ipv4': '1.2.{3.5', + 'ttl': 3600, + 'comment': '', + }, + # (127, 42, 'AAAA', '', '2001:1:2::{3', 3600, None, None), + { + 'id': 127, + 'type': 'AAAA', + 'name': '', + 'ipv6': '2001:1:2::{3', + 'ttl': 3600, + 'comment': '', + }, + # (128, 42, 'AAAA', '*', '2001:1:2::{4', 3600, None, None), + { + 'id': 128, + 'type': 'AAAA', + 'name': 'foo', + 'ipv6': '2001:1:2::{4', + 'ttl': 3600, + 'comment': '', + }, + # (129, 42, 'MX', '', 'example.com', 3600, None, '10'), + { + 'id': 129, + 'type': 'MX', + 'ownername': '', + 'name': 'example.com', + 'pref': 10, + 'ttl': 3600, + 'comment': '', + }, + # (130, 42, 'CNAME', 'bar', 'example.org.', 10800, None, None), + { + 'id': 130, + 'type': 'CNAME', + 'name': 'bar', + 'cname': 'example.org.', + 'ttl': 10800, + 'comment': '', + }, +] + HOSTTECH_JSON_ZONE_LIST_RESULT = { "data": [ @@ -119,6 +177,18 @@ HOSTTECH_JSON_ZONE_RECORDS_GET_RESULT = { "data": HOSTTECH_JSON_DEFAULT_ENTRIES, } +HOSTTECH_JSON_ZONE_GET_RESULT_UNSAFE = { + "data": { + "id": 42, + "name": "example.com", + "email": "test@example.com", + "ttl": 10800, + "nameserver": "ns1.hosttech.ch", + "dnssec": False, + "records": HOSTTECH_JSON_DEFAULT_ENTRIES_UNSAFE, + } +} + original_exists = os.path.exists original_access = os.access @@ -167,7 +237,7 @@ def test_inventory_file_simple(mocker): .expect_header('authorization', 'Bearer foo') .expect_url('https://api.ns1.hosttech.eu/api/user/v1/zones/42') .return_header('Content-Type', 'application/json') - .result_json(HOSTTECH_JSON_ZONE_GET_RESULT), + .result_json(HOSTTECH_JSON_ZONE_GET_RESULT_UNSAFE), ]) mocker.patch('ansible_collections.community.dns.plugins.module_utils.http.open_url', open_url) mocker.patch('ansible.inventory.manager.unfrackpath', mock_unfrackpath_noop) @@ -184,8 +254,8 @@ def test_inventory_file_simple(mocker): assert 'bar.example.com' not in im._inventory.hosts assert im._inventory.get_host('example.com') in im._inventory.groups['ungrouped'].hosts assert im._inventory.get_host('*.example.com') in im._inventory.groups['ungrouped'].hosts - assert im._inventory.get_host('example.com').get_vars()['ansible_host'] == '1.2.3.4' - assert im._inventory.get_host('*.example.com').get_vars()['ansible_host'] == '1.2.3.5' + assert im._inventory.get_host('example.com').get_vars()['ansible_host'] == '1.2.{3.4' + assert im._inventory.get_host('*.example.com').get_vars()['ansible_host'] == '1.2.{3.5' assert isinstance(im._inventory.get_host('example.com').get_vars()['ansible_host'], AnsibleUnsafe) assert isinstance(im._inventory.get_host('*.example.com').get_vars()['ansible_host'], AnsibleUnsafe) assert len(im._inventory.groups['ungrouped'].hosts) == 2 diff --git a/ansible_collections/community/dns/tests/unit/requirements-stable-2.10.txt b/ansible_collections/community/dns/tests/unit/requirements-stable-2.10.txt index 126caabdc..49df5eff9 100644 --- a/ansible_collections/community/dns/tests/unit/requirements-stable-2.10.txt +++ b/ansible_collections/community/dns/tests/unit/requirements-stable-2.10.txt @@ -10,4 +10,4 @@ ipaddress ; python_version < '3.3' dnspython < 2.4.0 lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 or later -lxml ; python_version >= '2.7' +lxml < 5.2.0 ; python_version >= '2.7' # lxml 5.2.0 does fail with Python 3.6 due to TOML loading failure -- cgit v1.2.3