From c16a5f3780cb84c8b87445a5027c939741d4d66c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:27:43 +0100 Subject: [PATCH] Allow LDAP search to run in check mode (#3667) (#3724) * Allow ldap search to run in check mode always * Fix indentions * Remove Comments and Chg Fragment * Update changelogs/fragments/3667-ldap_search.yml Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Sebastian Trupiano Co-authored-by: Felix Fontein Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> (cherry picked from commit 115d435d2daca1e3202305ddae56af96cec788e6) Co-authored-by: sabman3 --- changelogs/fragments/3667-ldap_search.yml | 2 ++ plugins/modules/net_tools/ldap/ldap_search.py | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/3667-ldap_search.yml diff --git a/changelogs/fragments/3667-ldap_search.yml b/changelogs/fragments/3667-ldap_search.yml new file mode 100644 index 0000000000..2b155aefa5 --- /dev/null +++ b/changelogs/fragments/3667-ldap_search.yml @@ -0,0 +1,2 @@ +bugfixes: + - ldap_search - allow it to be used even in check mode (https://github.com/ansible-collections/community.general/issues/3619). diff --git a/plugins/modules/net_tools/ldap/ldap_search.py b/plugins/modules/net_tools/ldap/ldap_search.py index 6b83321ff9..d3378646ac 100644 --- a/plugins/modules/net_tools/ldap/ldap_search.py +++ b/plugins/modules/net_tools/ldap/ldap_search.py @@ -106,11 +106,10 @@ def main(): module.fail_json(msg=missing_required_lib('python-ldap'), exception=LDAP_IMP_ERR) - if not module.check_mode: - try: - LdapSearch(module).main() - except Exception as exception: - module.fail_json(msg="Attribute action failed.", details=to_native(exception)) + try: + LdapSearch(module).main() + except Exception as exception: + module.fail_json(msg="Attribute action failed.", details=to_native(exception)) module.exit_json(changed=False)