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 0000000000..88d0f401ea --- /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 75135c8277..1d708cdce0 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