Skip to content
Snippets Groups Projects
Commit 05a1aaed authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

Fixes host absent when DNS zone is not found.

Since ipahost uses dnsrecord-show, it raises an error when DNS zone is
not found, but it should not be an ipahost concern.

This patch fixes this behavior by returning no record if DNS zone is
not found, so processing resumes as if there is no record for the host.
It fixes behavior when `state: absent` and dnszone does not exist, so,
host should not exist either, and the ipahost answer is correct and
indifferent to DNS Zone state.
parent 44af47d9
No related branches found
No related tags found
No related merge requests found
......@@ -452,7 +452,7 @@ def find_dnsrecord(module, name):
_args)
except ipalib_errors.NotFound as e:
msg = str(e)
if "record not found" in msg:
if "record not found" in msg or "zone not found" in msg:
return None
module.fail_json(msg="dnsrecord_show failed: %s" % msg)
......
---
- name: Test host
hosts: ipaserver
become: yes
tasks:
- name: Ensure host with inexistent zone is absent.
ipahost:
name: host01.absentzone.test
state: absent
register: result
failed_when: result.failed or result.changed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment