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

Fix error message when adding a service without principal.

parent c9210ca2
No related branches found
No related tags found
No related merge requests found
......@@ -217,6 +217,7 @@ from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
temp_kdestroy, valid_creds, api_connect, api_command, compare_args_ipa, \
encode_certificate, gen_add_del_lists, module_params_get, to_text, \
api_check_param
import ipalib.errors
def find_service(module, name):
......@@ -224,13 +225,13 @@ def find_service(module, name):
"all": True,
}
_result = api_command(module, "service_find", to_text(name), _args)
try:
_result = api_command(module, "service_show", to_text(name), _args)
except ipalib.errors.NotFound:
return None
if len(_result["result"]) > 1:
module.fail_json(
msg="There is more than one service '%s'" % (name))
elif len(_result["result"]) == 1:
_res = _result["result"][0]
if "result" in _result:
_res = _result["result"]
certs = _res.get("usercertificate")
if certs is not None:
_res["usercertificate"] = [encode_certificate(cert) for
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment