mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-29 19:04:42 +00:00
Fix error message when adding a service without principal.
This commit is contained in:
@@ -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, \
|
temp_kdestroy, valid_creds, api_connect, api_command, compare_args_ipa, \
|
||||||
encode_certificate, gen_add_del_lists, module_params_get, to_text, \
|
encode_certificate, gen_add_del_lists, module_params_get, to_text, \
|
||||||
api_check_param
|
api_check_param
|
||||||
|
import ipalib.errors
|
||||||
|
|
||||||
|
|
||||||
def find_service(module, name):
|
def find_service(module, name):
|
||||||
@@ -224,13 +225,13 @@ def find_service(module, name):
|
|||||||
"all": True,
|
"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:
|
if "result" in _result:
|
||||||
module.fail_json(
|
_res = _result["result"]
|
||||||
msg="There is more than one service '%s'" % (name))
|
|
||||||
elif len(_result["result"]) == 1:
|
|
||||||
_res = _result["result"][0]
|
|
||||||
certs = _res.get("usercertificate")
|
certs = _res.get("usercertificate")
|
||||||
if certs is not None:
|
if certs is not None:
|
||||||
_res["usercertificate"] = [encode_certificate(cert) for
|
_res["usercertificate"] = [encode_certificate(cert) for
|
||||||
|
|||||||
Reference in New Issue
Block a user