Skip to content
Snippets Groups Projects
Unverified Commit e36961f3 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman Committed by GitHub
Browse files

Merge pull request #269 from t-woerner/use_dnsrecord_show

ipahost: Use dnsrecord_show instead of dnsrecord_find command
parents e8317b28 2b084e6d
No related branches found
No related tags found
No related merge requests found
...@@ -444,24 +444,19 @@ def find_dnsrecord(module, name): ...@@ -444,24 +444,19 @@ def find_dnsrecord(module, name):
_args = { _args = {
"all": True, "all": True,
"idnsname": to_text(host_name), "idnsname": to_text(host_name)
} }
_result = api_command(module, "dnsrecord_find", to_text(domain_name), try:
_result = api_command(module, "dnsrecord_show", to_text(domain_name),
_args) _args)
except ipalib_errors.NotFound as e:
if len(_result["result"]) > 1: msg = str(e)
module.fail_json( if "record not found" in msg:
msg="There is more than one host '%s'" % (name))
elif len(_result["result"]) == 1:
_res = _result["result"][0]
certs = _res.get("usercertificate")
if certs is not None:
_res["usercertificate"] = [encode_certificate(cert) for
cert in certs]
return _res
else:
return None return None
module.fail_json(msg="dnsrecord_show failed: %s" % msg)
return _result["result"]
def show_host(module, name): def show_host(module, name):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment