mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 11:24:50 +00:00
Merge pull request #435 from rjeffman/fix_ipahost_fails_without_dns
Fix ipahost module when adding hosts to a server without DNS support.
This commit is contained in:
@@ -439,6 +439,12 @@ def find_host(module, name):
|
|||||||
|
|
||||||
|
|
||||||
def find_dnsrecord(module, name):
|
def find_dnsrecord(module, name):
|
||||||
|
"""
|
||||||
|
Search for a DNS record.
|
||||||
|
|
||||||
|
This function may raise ipalib_errors.NotFound in some cases,
|
||||||
|
and it should be handled by the caller.
|
||||||
|
"""
|
||||||
domain_name = name[name.find(".")+1:]
|
domain_name = name[name.find(".")+1:]
|
||||||
host_name = name[:name.find(".")]
|
host_name = name[:name.find(".")]
|
||||||
|
|
||||||
@@ -447,14 +453,8 @@ def find_dnsrecord(module, name):
|
|||||||
"idnsname": to_text(host_name)
|
"idnsname": to_text(host_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
_result = api_command(module, "dnsrecord_show", to_text(domain_name),
|
||||||
_result = api_command(module, "dnsrecord_show", to_text(domain_name),
|
_args)
|
||||||
_args)
|
|
||||||
except ipalib_errors.NotFound as e:
|
|
||||||
msg = str(e)
|
|
||||||
if "record not found" in msg or "zone not found" in msg:
|
|
||||||
return None
|
|
||||||
module.fail_json(msg="dnsrecord_show failed: %s" % msg)
|
|
||||||
|
|
||||||
return _result["result"]
|
return _result["result"]
|
||||||
|
|
||||||
@@ -876,8 +876,11 @@ def main():
|
|||||||
msg = str(e)
|
msg = str(e)
|
||||||
dns_not_configured = "DNS is not configured" in msg
|
dns_not_configured = "DNS is not configured" in msg
|
||||||
dns_zone_not_found = "DNS zone not found" in msg
|
dns_zone_not_found = "DNS zone not found" in msg
|
||||||
if ip_address is None and (
|
dns_res_not_found = "DNS resource record not found" in msg
|
||||||
dns_not_configured or dns_zone_not_found
|
if (
|
||||||
|
dns_res_not_found
|
||||||
|
or ip_address is None
|
||||||
|
and (dns_not_configured or dns_zone_not_found)
|
||||||
):
|
):
|
||||||
# IP address(es) not given and no DNS support in IPA
|
# IP address(es) not given and no DNS support in IPA
|
||||||
# -> Ignore failure
|
# -> Ignore failure
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ You will also need to have a remote host with freeipa server installed and confi
|
|||||||
Some other requirements:
|
Some other requirements:
|
||||||
|
|
||||||
* The `controller` must be able to connect to `ipaserver` through ssh using keys.
|
* The `controller` must be able to connect to `ipaserver` through ssh using keys.
|
||||||
* `ipaserver` must be configured with DNS and KRA support.
|
|
||||||
See [ipaserver role](../roles/ipaserver/README.md).
|
|
||||||
* IPA admin password must be `SomeADMINpassword`.
|
* IPA admin password must be `SomeADMINpassword`.
|
||||||
* Directory Server admin password must be `SomeDMpassword`.
|
* Directory Server admin password must be `SomeDMpassword`.
|
||||||
|
|
||||||
|
To provide broader test coverage, `ipaserver` should be configured with DNS and KRA support, and playbook tests are written based on this configuration. Without such support, some tests are expected to fail. Use a different configuration to evaluate those scenarios. See also [ipaserver role](../roles/ipaserver/README.md).
|
||||||
|
|
||||||
## Running the tests
|
## Running the tests
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user