From 06675034fef477562db69277203805008e2979f8 Mon Sep 17 00:00:00 2001 From: drevai753 <86595897+drevai753@users.noreply.github.com> Date: Wed, 13 Apr 2022 07:10:15 +0200 Subject: [PATCH] dnsmadeeasy: only get monitor if it is not null api response (#4459) * Only get monitor if it is not null api response * Add changelog fragment * Update changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml Co-authored-by: Felix Fontein * Update plugins/modules/net_tools/dnsmadeeasy.py Co-authored-by: Felix Fontein Co-authored-by: drevai Co-authored-by: Felix Fontein --- .../4459-only-get-monitor-if-it-is-not-null-api-response.yaml | 2 ++ plugins/modules/net_tools/dnsmadeeasy.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml diff --git a/changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml b/changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml new file mode 100644 index 00000000000..88d0f401eaa --- /dev/null +++ b/changelogs/fragments/4459-only-get-monitor-if-it-is-not-null-api-response.yaml @@ -0,0 +1,2 @@ +bugfixes: + - dnsmadeeasy - fix failure on deleting DNS entries when API response does not contain monitor value (https://github.com/ansible-collections/community.general/issues/3620). \ No newline at end of file diff --git a/plugins/modules/net_tools/dnsmadeeasy.py b/plugins/modules/net_tools/dnsmadeeasy.py index 75135c82777..1d708cdce0e 100644 --- a/plugins/modules/net_tools/dnsmadeeasy.py +++ b/plugins/modules/net_tools/dnsmadeeasy.py @@ -623,7 +623,7 @@ def main(): # Fetch existing monitor if the A record indicates it should exist and build the new monitor current_monitor = dict() new_monitor = dict() - if current_record and current_record['type'] == 'A': + if current_record and current_record['type'] == 'A' and current_record.get('monitor'): current_monitor = DME.getMonitor(current_record['id']) # Build the new monitor