hbacrule: Create FQDN from single hostnames

Single hostnames can be used for hbacrule_add_host and will match fqdn
in IPA internally. Simple host names have to be extended to be FQDN to
be able to compare them for _host_add and _host_remove.

Two new functions have been added to ansible_freeipa_module:

- api_get_domain - Get the domain from the api
- ensure_fqdn - Extend a single name with the domain

This fixes #617 - hbacrule_add_host: already a member
This commit is contained in:
Thomas Woerner
2021-08-19 17:40:38 +02:00
parent 5fd4a0c5a6
commit b8488cb933
3 changed files with 40 additions and 1 deletions

View File

@@ -370,6 +370,14 @@ else:
def module_params_get(module, name):
return _afm_convert(module.params.get(name))
def api_get_domain():
return api.env.domain
def ensure_fqdn(name, domain):
if "." not in name:
return "%s.%s" % (name, domain)
return name
def api_get_realm():
return api.env.realm