From bc0f211c29e0a91ce479de37f9d05f27a1b7c26e Mon Sep 17 00:00:00 2001 From: Thomas Woerner <twoerner@redhat.com> Date: Wed, 9 Oct 2019 11:49:29 +0200 Subject: [PATCH] ansible_freeipa_module: api_command should not have extra try clause api_command is always used within try clause, therefore it is not needed to have an extra try clause within api_command. Additionally it is needed to get the dofferent errors in the next level. --- plugins/module_utils/ansible_freeipa_module.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 28f82e23..4b884227 100644 --- a/plugins/module_utils/ansible_freeipa_module.py +++ b/plugins/module_utils/ansible_freeipa_module.py @@ -122,12 +122,9 @@ def api_connect(): def api_command(module, command, name, args): """ - Call ipa.Command, use AnsibleModule.fail_json for error handling + Call ipa.Command """ - try: - return api.Command[command](name, **args) - except Exception as e: - module.fail_json(msg="%s: %s" % (command, e)) + return api.Command[command](name, **args) def execute_api_command(module, principal, password, command, name, args): -- GitLab