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

Fix error message when adding dnsforwardzone without forwarders.

parent f8ebca76
No related branches found
No related tags found
No related merge requests found
......@@ -217,6 +217,11 @@ def main():
# Make sure forwardzone exists
existing_resource = find_dnsforwardzone(ansible_module, name)
# validate parameters
if state == 'present':
if existing_resource is None and not forwarders:
ansible_module.fail_json(msg='No forwarders specified.')
if existing_resource is None and operation == "update":
# does not exist and is updating
# trying to update something that doesn't exist, so error
......
......@@ -5,10 +5,12 @@
gather_facts: false
tasks:
- name: ensure forwardzone example.com is absent - prep
- name: ensure test forwardzones are absent - prep
ipadnsforwardzone:
ipaadmin_password: SomeADMINpassword
name: example.com
name:
- example.com
- newfailzone.com
state: absent
- name: ensure forwardzone example.com is created
......@@ -207,6 +209,13 @@
register: result
failed_when: result.changed
- name: Ensure forwardzone is not added without forwarders, with correct message.
ipadnsforwardzone:
ipaadmin_password: SomeADMINpassword
name: newfailzone.com
register: result
failed_when: not result.failed or "No forwarders specified" not in result.msg
- name: ensure forwardzone example.com is absent - tidy up
ipadnsforwardzone:
ipaadmin_password: SomeADMINpassword
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment