From e0274adafeb8398b4c163e0b540ee9c9a6eed15d Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Fri, 22 Feb 2019 09:58:16 +0100 Subject: [PATCH] Filter DNSimple request by record name. (#49981) * Filter DNSimple request by record name. The request was not filtered and DNSimple returns only the first 100 records so if the number of records is larger the check could fail. This patch fixes the issue and also makes the check to perform better. * Add changelog fragment. --- .../fragments/49981-filter-dnsimple-request-by-record-name.yaml | 2 ++ lib/ansible/modules/net_tools/dnsimple.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/49981-filter-dnsimple-request-by-record-name.yaml diff --git a/changelogs/fragments/49981-filter-dnsimple-request-by-record-name.yaml b/changelogs/fragments/49981-filter-dnsimple-request-by-record-name.yaml new file mode 100644 index 00000000000..9a9ec50460e --- /dev/null +++ b/changelogs/fragments/49981-filter-dnsimple-request-by-record-name.yaml @@ -0,0 +1,2 @@ +bugfixes: + - fix DNSimple to ensure check works even when the number of records is larger than 100 diff --git a/lib/ansible/modules/net_tools/dnsimple.py b/lib/ansible/modules/net_tools/dnsimple.py index ad5dfc4299c..2feaf563153 100644 --- a/lib/ansible/modules/net_tools/dnsimple.py +++ b/lib/ansible/modules/net_tools/dnsimple.py @@ -239,7 +239,7 @@ def main(): # need the not none check since record could be an empty string if domain and record is not None: - records = [r['record'] for r in client.records(str(domain))] + records = [r['record'] for r in client.records(str(domain), params={'name': record})] if not record_type: module.fail_json(msg="Missing the record type")