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

Merge pull request #619 from t-woerner/hbacrule_make_single_hostname_fqdn

hbacrule: Create FQDN from single hostnames
parents 5fd4a0c5 b8488cb9
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -159,7 +159,8 @@ RETURN = """
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
temp_kdestroy, valid_creds, api_connect, api_command, compare_args_ipa, \
module_params_get, gen_add_del_lists, gen_add_list, gen_intersection_list
module_params_get, gen_add_del_lists, gen_add_list, \
gen_intersection_list, api_get_domain, ensure_fqdn
def find_hbacrule(module, name):
......@@ -325,6 +326,14 @@ def main():
ipaadmin_password)
api_connect()
# Get default domain
default_domain = api_get_domain()
# Ensure fqdn host names, use default domain for simple names
if host is not None:
_host = [ensure_fqdn(x, default_domain) for x in host]
host = _host
commands = []
for name in names:
......
......@@ -580,6 +580,28 @@
register: result
failed_when: result.changed or result.failed
# ENSURE SIMPLE HOSTNAMES MATCH
- name: Ensure HBAC rule hbacrule01 simple host members are usable
ipahbacrule:
ipaadmin_password: SomeADMINpassword
name: hbacrule01
host:
- "testhost01"
- "testhost03"
register: result
failed_when: not result.changed or result.failed
- name: Ensure HBAC rule hbacrule01 simple host members are usable again (and match)
ipahbacrule:
ipaadmin_password: SomeADMINpassword
name: hbacrule01
host:
- "testhost01"
- "testhost03"
register: result
failed_when: result.changed or result.failed
# CLEANUP TEST ITEMS
- name: Ensure test HBAC rule hbacrule01 is absent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment