Skip to content
Snippets Groups Projects
Unverified Commit 29fb281b authored by Thomas Woerner's avatar Thomas Woerner Committed by GitHub
Browse files

Merge pull request #582 from rjeffman/dnszone_add_check_mode_support

ipadnszone: add check mode support
parents 07b47cab a84071b8
No related branches found
No related tags found
No related merge requests found
...@@ -962,6 +962,10 @@ else: ...@@ -962,6 +962,10 @@ else:
def _run_ipa_commands(self): def _run_ipa_commands(self):
"""Execute commands in self.ipa_commands.""" """Execute commands in self.ipa_commands."""
if self.check_mode:
self.changed = len(self.ipa_commands) > 0
return
result = None result = None
for name, command, args in self.ipa_commands: for name, command, args in self.ipa_commands:
......
...@@ -537,6 +537,7 @@ def main(): ...@@ -537,6 +537,7 @@ def main():
argument_spec=get_argument_spec(), argument_spec=get_argument_spec(),
mutually_exclusive=[["name", "name_from_ip"]], mutually_exclusive=[["name", "name_from_ip"]],
required_one_of=[["name", "name_from_ip"]], required_one_of=[["name", "name_from_ip"]],
supports_check_mode=True,
).ipa_run() ).ipa_run()
......
...@@ -11,6 +11,24 @@ ...@@ -11,6 +11,24 @@
include_tasks: env_setup.yml include_tasks: env_setup.yml
# Tests # Tests
- name: Check if zone is present, when in shouldn't be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: not result.changed or result.failed
- name: Check if zone is present again, when in shouldn't be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: not result.changed or result.failed
- name: Ensure zone is present. - name: Ensure zone is present.
ipadnszone: ipadnszone:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
...@@ -19,6 +37,15 @@ ...@@ -19,6 +37,15 @@
register: result register: result
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
- name: Check if zone is present, when in should be.
ipadnszone:
ipaadmin_password: SomeADMINpassword
name: testzone.local
state: present
check_mode: yes
register: result
failed_when: result.changed or result.failed
- name: Ensure zone is present, again. - name: Ensure zone is present, again.
ipadnszone: ipadnszone:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment