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

Merge pull request #549 from t-woerner/host_fix_DNS_resource_record_not_found

host: Fix DNS resource record not found error
parents 7ba057f1 c8eb6d74
No related branches found
No related tags found
No related merge requests found
...@@ -1327,6 +1327,23 @@ def main(): ...@@ -1327,6 +1327,23 @@ def main():
dnsrecord_args = gen_dnsrecord_args(ansible_module, dnsrecord_args = gen_dnsrecord_args(ansible_module,
ip_address, reverse) ip_address, reverse)
# Remove arecord and aaaarecord from dnsrecord_args
# if the record does not exits in res_find_dnsrecord
# to prevent "DNS resource record not found" error
if "arecord" in dnsrecord_args \
and dnsrecord_args["arecord"] is not None \
and len(dnsrecord_args["arecord"]) > 0 \
and (res_find_dnsrecord is None
or "arecord" not in res_find_dnsrecord):
del dnsrecord_args["arecord"]
if "aaaarecord" in dnsrecord_args \
and dnsrecord_args["aaaarecord"] is not None \
and len(dnsrecord_args["aaaarecord"]) > 0 \
and (res_find_dnsrecord is None
or "aaaarecord" not in res_find_dnsrecord):
del dnsrecord_args["aaaarecord"]
if "arecord" in dnsrecord_args or \ if "arecord" in dnsrecord_args or \
"aaaarecord" in dnsrecord_args: "aaaarecord" in dnsrecord_args:
domain_name = name[name.find(".")+1:] domain_name = name[name.find(".")+1:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment