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.
This commit is contained in:
Thomas Woerner
2019-10-09 11:49:29 +02:00
parent 6e2fa7e7d6
commit bc0f211c29

View File

@@ -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):