Merge pull request #709 from t-woerner/automationhub_fixes2

More Automation Hub fixes
This commit is contained in:
Rafael Guterres Jeffman
2021-12-14 17:59:46 -03:00
committed by GitHub
15 changed files with 126 additions and 58 deletions

View File

@@ -1132,6 +1132,7 @@ else:
self.deprecate( self.deprecate(
msg="FreeIPABaseModule is deprecated. Use IPAAnsibleModule.", msg="FreeIPABaseModule is deprecated. Use IPAAnsibleModule.",
version="1.5.0"
) )
# Status of an execution. Will be changed to True # Status of an execution. Will be changed to True
@@ -1174,7 +1175,8 @@ else:
"FreeIPABaseModule is deprecated. Use IPAAnsibleModule. " "FreeIPABaseModule is deprecated. Use IPAAnsibleModule. "
"Use 'AnsibleFreeIPAParams.get_ipa_command_args()', " "Use 'AnsibleFreeIPAParams.get_ipa_command_args()', "
"Instantiate it using the class 'ipa_params_mapping'." "Instantiate it using the class 'ipa_params_mapping'."
) ),
version="1.5.0"
) )
mapping = IPAParamMapping(self, self.ipa_param_mapping) mapping = IPAParamMapping(self, self.ipa_param_mapping)
return mapping.get_ipa_command_args(**kwargs) return mapping.get_ipa_command_args(**kwargs)
@@ -1185,6 +1187,7 @@ else:
msg=( msg=(
"FreeIPABaseModule is deprecated. Use IPAAnsibleModule. " "FreeIPABaseModule is deprecated. Use IPAAnsibleModule. "
), ),
version="1.5.0"
) )
pass # pylint: disable=unnecessary-pass pass # pylint: disable=unnecessary-pass
@@ -1217,6 +1220,7 @@ else:
msg=( msg=(
"FreeIPABaseModule is deprecated. Use IPAAnsibleModule. " "FreeIPABaseModule is deprecated. Use IPAAnsibleModule. "
), ),
version="1.5.0"
) )
self.process_command_result(name, command, args, result) self.process_command_result(name, command, args, result)
@@ -1234,6 +1238,7 @@ else:
"To aid in porting to IPAAnsibleModule, change to " "To aid in porting to IPAAnsibleModule, change to "
"'FreeIPABaseModule.process_results'." "'FreeIPABaseModule.process_results'."
), ),
version="1.5.0"
) )
if "completed" in result: if "completed" in result:
@@ -1255,6 +1260,7 @@ else:
"FreeIPABaseModule require_ipa_attrs_change() is " "FreeIPABaseModule require_ipa_attrs_change() is "
"deprecated. Use ansible_freeipa_module.compare_args()." "deprecated. Use ansible_freeipa_module.compare_args()."
), ),
version="1.5.0"
) )
equal = compare_args_ipa(self, command_args, ipa_attrs) equal = compare_args_ipa(self, command_args, ipa_attrs)
return not equal return not equal
@@ -1265,6 +1271,7 @@ else:
msg=( msg=(
"FreeIPABaseModule is deprecated. Use IPAAnsibleModule." "FreeIPABaseModule is deprecated. Use IPAAnsibleModule."
), ),
version="1.5.0"
) )
ipaapi_context = self.params_get("ipaapi_context") ipaapi_context = self.params_get("ipaapi_context")
with self.ipa_connect(context=ipaapi_context): with self.ipa_connect(context=ipaapi_context):

View File

@@ -194,19 +194,23 @@ def main():
argument_spec=dict( argument_spec=dict(
# general # general
inclusive=dict(type="list", inclusive=dict(type="list",
aliases=["automemberinclusiveregex"], default=None, aliases=["automemberinclusiveregex"],
default=None,
options=dict( options=dict(
key=dict(type="str", required=True), key=dict(type="str", required=True),
expression=dict(type="str", required=True) expression=dict(type="str", required=True)
), ),
elements="dict", required=False), elements="dict",
exclusive=dict(type="list", aliases=[ required=False),
"automemberexclusiveregex"], default=None, exclusive=dict(type="list",
aliases=["automemberexclusiveregex"],
default=None,
options=dict( options=dict(
key=dict(type="str", required=True), key=dict(type="str", required=True),
expression=dict(type="str", required=True) expression=dict(type="str", required=True)
), ),
elements="dict", required=False), elements="dict",
required=False),
name=dict(type="list", aliases=["cn"], name=dict(type="list", aliases=["cn"],
default=None, required=True), default=None, required=True),
description=dict(type="str", default=None), description=dict(type="str", default=None),

View File

@@ -299,7 +299,7 @@ def main():
"KDC:Disable Last Success", "KDC:Disable Last Success",
"KDC:Disable Lockout", "KDC:Disable Lockout",
"KDC:Disable Default Preauth for SPNs", "KDC:Disable Default Preauth for SPNs",
""]), # noqa E128 ""]), # noqa E128
selinuxusermaporder=dict(type="list", required=False, selinuxusermaporder=dict(type="list", required=False,
aliases=['ipaselinuxusermaporder']), aliases=['ipaselinuxusermaporder']),
selinuxusermapdefault=dict(type="str", required=False, selinuxusermapdefault=dict(type="str", required=False,
@@ -365,15 +365,15 @@ def main():
if params.get("ipadomainresolutionorder", None): if params.get("ipadomainresolutionorder", None):
params["ipadomainresolutionorder"] = \ params["ipadomainresolutionorder"] = \
":".join(params["ipadomainresolutionorder"]) ":".join(params["ipadomainresolutionorder"])
if params.get("ipausersearchfields", None): if params.get("ipausersearchfields", None):
params["ipausersearchfields"] = \ params["ipausersearchfields"] = \
",".join(params["ipausersearchfields"]) ",".join(params["ipausersearchfields"])
if params.get("ipagroupsearchfields", None): if params.get("ipagroupsearchfields", None):
params["ipagroupsearchfields"] = \ params["ipagroupsearchfields"] = \
",".join(params["ipagroupsearchfields"]) ",".join(params["ipagroupsearchfields"])
# verify limits on INT values. # verify limits on INT values.
args_with_limits = [ args_with_limits = [
@@ -418,12 +418,12 @@ def main():
if ansible_module.argument_spec.get(k): if ansible_module.argument_spec.get(k):
arg_type = ansible_module.argument_spec[k]['type'] arg_type = ansible_module.argument_spec[k]['type']
if k in ( if k in (
'ipaselinuxusermaporder', 'domain_resolution_order' 'ipaselinuxusermaporder', 'domain_resolution_order'
): ):
exit_args[k] = result.get(key)[0].split('$') exit_args[k] = result.get(key)[0].split('$')
elif k in ( elif k in (
'usersearch', 'groupsearch' 'usersearch', 'groupsearch'
): ):
exit_args[k] = result.get(key)[0].split(',') exit_args[k] = result.get(key)[0].split(',')
elif isinstance(value, str) and arg_type == "list": elif isinstance(value, str) and arg_type == "list":
exit_args[k] = [value] exit_args[k] = [value]

View File

@@ -165,24 +165,23 @@ def gen_args(module, state, dnsconfig, forwarders, forward_policy,
def main(): def main():
forwarder_spec = dict( forwarder_spec = dict(
ip_address=dict(type=str, required=True), ip_address=dict(type=str, required=True),
port=dict(type=int, required=False, default=None) port=dict(type=int, required=False, default=None)
) )
ansible_module = IPAAnsibleModule( ansible_module = IPAAnsibleModule(
argument_spec=dict( argument_spec=dict(
# dnsconfig # dnsconfig
forwarders=dict(type='list', default=None, required=False, forwarders=dict(type='list', default=None, required=False,
options=dict(**forwarder_spec)), options=dict(**forwarder_spec)),
forward_policy=dict(type='str', required=False, default=None, forward_policy=dict(type='str', required=False, default=None,
choices=['only', 'first', 'none']), choices=['only', 'first', 'none']),
allow_sync_ptr=dict(type='bool', required=False, default=None), allow_sync_ptr=dict(type='bool', required=False, default=None),
# general # general
state=dict(type="str", default="present", state=dict(type="str", default="present",
choices=["present", "absent"]), choices=["present", "absent"]),
)
)
) )
ansible_module._ansible_debug = True ansible_module._ansible_debug = True

View File

@@ -1108,12 +1108,13 @@ def configure_module():
name=dict(type="list", aliases=["record_name"], default=None, name=dict(type="list", aliases=["record_name"], default=None,
required=False), required=False),
records=dict(type="list", default=None, records=dict(type="list",
default=None,
options=dict( options=dict(
# Here name is a simple string # Here name is a simple string
name=dict(type='str', required=True, name=dict(type='str', required=True,
aliases=['record_name']), aliases=['record_name']),
**record_spec), **record_spec),
), ),
# general # general

View File

@@ -550,10 +550,10 @@ def main():
ansible_module.check_ipa_params() ansible_module.check_ipa_params()
ansible_module.define_ipa_commands() ansible_module.define_ipa_commands()
changed = ansible_module.execute_ipa_commands( changed = ansible_module.execute_ipa_commands(
ansible_module.commands, ansible_module.commands,
result_handler=DNSZoneModule.process_results, result_handler=DNSZoneModule.process_results,
exit_args=exit_args exit_args=exit_args
) )
ansible_module.exit_json(changed=changed, **exit_args) ansible_module.exit_json(changed=changed, **exit_args)

View File

@@ -393,13 +393,13 @@ def main():
# If yes: modify # If yes: modify
# Also if it is a modification from nonposix to posix # Also if it is a modification from nonposix to posix
# or nonposix to external. # or nonposix to external.
if not compare_args_ipa(ansible_module, args, if not compare_args_ipa(
res_find) or \ ansible_module, args, res_find
( ) or (
not is_posix_group(res_find) and not is_posix_group(res_find) and
not is_external_group(res_find) and not is_external_group(res_find) and
(posix or external) (posix or external)
): ):
if posix: if posix:
args['posix'] = True args['posix'] = True
if external: if external:

View File

@@ -199,7 +199,7 @@ def ensure_absent_state(module, name, action, res_find):
member_args = {} member_args = {}
for key in ['user', 'group', 'host', 'hostgroup']: for key in ['user', 'group', 'host', 'hostgroup']:
items = member_intersect( items = member_intersect(
module, key, 'member_%s' % key, res_find) module, key, 'member_%s' % key, res_find)
if items: if items:
member_args[key] = items member_args[key] = items
@@ -298,7 +298,7 @@ def ensure_members_are_present(module, name, res_find):
member_args = {} member_args = {}
for key in ['user', 'group', 'host', 'hostgroup']: for key in ['user', 'group', 'host', 'hostgroup']:
items = member_difference( items = member_difference(
module, key, 'member_%s' % key, res_find) module, key, 'member_%s' % key, res_find)
if items: if items:
member_args[key] = items member_args[key] = items

View File

@@ -577,7 +577,7 @@ def main():
args.get("krbprincipalauthind", [""]) == args.get("krbprincipalauthind", [""]) ==
res_find.get("krbprincipalauthind", [""]) res_find.get("krbprincipalauthind", [""])
) )
): ):
del args["krbprincipalauthind"] del args["krbprincipalauthind"]
if not compare_args_ipa(ansible_module, args, if not compare_args_ipa(ansible_module, args,

View File

@@ -824,14 +824,17 @@ def main():
# general # general
name=dict(type="list", aliases=["login"], default=None, name=dict(type="list", aliases=["login"], default=None,
required=False), required=False),
users=dict(type="list", aliases=["login"], default=None, users=dict(type="list",
aliases=["login"],
default=None,
options=dict( options=dict(
# Here name is a simple string # Here name is a simple string
name=dict(type="str", required=True), name=dict(type="str", required=True),
# Add user specific parameters # Add user specific parameters
**user_spec **user_spec
), ),
elements='dict', required=False), elements='dict',
required=False),
# deleted # deleted
preserve=dict(required=False, type='bool', default=None), preserve=dict(required=False, type='bool', default=None),

View File

@@ -634,7 +634,7 @@ def main():
vault_password_file=dict(type="str", required=False, default=None, vault_password_file=dict(type="str", required=False, default=None,
no_log=False, no_log=False,
aliases=[ aliases=[
'password_file', "old_password_file" 'password_file', "old_password_file"
]), ]),
new_password=dict(type="str", required=False, default=None, new_password=dict(type="str", required=False, default=None,
no_log=True), no_log=True),

View File

@@ -45,7 +45,7 @@ EXAMPLES = '''
# Get IPA_BACKUP_DIR from ipaplatform # Get IPA_BACKUP_DIR from ipaplatform
- name: Get IPA_BACKUP_DIR from ipaplatform - name: Get IPA_BACKUP_DIR from ipaplatform
ipabackup_get_backup_dir: ipabackup_get_backup_dir:
register result register: result
''' '''
RETURN = ''' RETURN = '''

View File

@@ -0,0 +1,55 @@
plugins/module_utils/ansible_freeipa_module.py compile-2.6!skip
plugins/module_utils/ansible_freeipa_module.py import-2.6!skip
plugins/module_utils/ansible_freeipa_module.py pylint:ansible-bad-import-from
plugins/module_utils/ansible_freeipa_module.py pylint:ansible-bad-function
plugins/module_utils/ansible_freeipa_module.py pylint:ansible-format-automatic-specification
plugins/module_utils/ansible_freeipa_module.py pylint:ansible-deprecated-no-collection-name
plugins/modules/ipaclient_get_facts.py compile-2.6!skip
plugins/modules/ipaclient_get_facts.py import-2.6!skip
plugins/modules/ipaclient_api.py pylint:ansible-format-automatic-specification
plugins/modules/ipaclient_join.py pylint:ansible-format-automatic-specification
plugins/modules/ipaclient_test.py pylint:ansible-format-automatic-specification
plugins/modules/ipaconfig.py compile-2.6!skip
plugins/modules/ipaconfig.py import-2.6!skip
plugins/modules/ipadnsrecord.py compile-2.6!skip
plugins/modules/ipadnsrecord.py import-2.6!skip
plugins/modules/ipadnsrecord.py pylint:ansible-format-automatic-specification
plugins/modules/ipadnsrecord.py pylint:use-maxsplit-arg
plugins/modules/ipareplica_enable_ipa.py pylint:ansible-format-automatic-specification
plugins/modules/ipareplica_prepare.py pylint:ansible-format-automatic-specification
plugins/modules/ipareplica_test.py pylint:ansible-format-automatic-specification
plugins/modules/ipaserver_setup_ca.py compile-2.6!skip
plugins/modules/ipaserver_setup_ca.py import-2.6!skip
plugins/modules/ipaserver_test.py pylint:ansible-format-automatic-specification
plugins/modules/ipaservice.py compile-2.6!skip
plugins/modules/ipaservice.py import-2.6!skip
plugins/modules/ipavault.py compile-2.6!skip
plugins/modules/ipavault.py import-2.6!skip
roles/ipaclient/library/ipaclient_api.py pylint:ansible-format-automatic-specification
roles/ipaclient/library/ipaclient_join.py pylint:ansible-format-automatic-specification
roles/ipaclient/library/ipaclient_test.py pylint:ansible-format-automatic-specification
roles/ipareplica/library/ipareplica_enable_ipa.py pylint:ansible-format-automatic-specification
roles/ipareplica/library/ipareplica_prepare.py pylint:ansible-format-automatic-specification
roles/ipareplica/library/ipareplica_test.py pylint:ansible-format-automatic-specification
roles/ipaserver/library/ipaserver_test.py pylint:ansible-format-automatic-specification
roles/ipareplica/module_utils/ansible_ipa_replica.py pylint:ansible-format-automatic-specification
tests/external-signed-ca-with-automatic-copy/external-ca.sh shebang!skip
tests/pytests/conftest.py pylint:ansible-format-automatic-specification
tests/user/users.sh shebang!skip
tests/user/users_absent.sh shebang!skip
tests/utils.py pylint:ansible-format-automatic-specification
tests/utils.py pylint:subprocess-run-check
utils/ansible-doc-test shebang!skip
utils/ansible-ipa-client-install shebang!skip
utils/ansible-ipa-replica-install shebang!skip
utils/ansible-ipa-server-install shebang!skip
utils/build-galaxy-release.sh shebang!skip
utils/build-srpm.sh shebang!skip
utils/changelog shebang!skip
utils/galaxyfy-README.py shebang!skip
utils/galaxyfy-module-EXAMPLES.py shebang!skip
utils/galaxyfy-playbook.py shebang!skip
utils/galaxyfy.py shebang!skip
utils/gen_modules_docs.sh shebang!skip
utils/lint_check.sh shebang!skip
utils/new_module shebang!skip

View File

@@ -84,7 +84,7 @@ rm plugins/module_utils/ansible_ipa_*
rm plugins/modules/ipaserver_* rm plugins/modules/ipaserver_*
rm plugins/modules/ipareplica_* rm plugins/modules/ipareplica_*
rm plugins/modules/ipaclient_* rm plugins/modules/ipaclient_*
rm plugins/modules/ipabackup_*
rm plugins/action/ipaclient_* rm plugins/action/ipaclient_*
rm plugins/action/ipabackup_*
rmdir plugins/action rmdir plugins/action
git reset --hard git reset --hard

View File

@@ -26,7 +26,7 @@ param_docs = {
"sssd": "The installer sssd setting", "sssd": "The installer sssd setting",
"dnsok": "The installer dnsok setting", "dnsok": "The installer dnsok setting",
"dm_password": "Directory Manager password", "dm_password": "Directory Manager password",
"password": "Admin user kerberos password", "password": "Admin user kerberos password",
"ip_addresses": "List of Master Server IP Addresses", "ip_addresses": "List of Master Server IP Addresses",
"domain": "Primary DNS domain of the IPA deployment", "domain": "Primary DNS domain of the IPA deployment",
@@ -55,10 +55,9 @@ param_docs = {
"no_pkinit": "Disable pkinit setup steps", "no_pkinit": "Disable pkinit setup steps",
"no_ui_redirect": "Do not automatically redirect to the Web UI", "no_ui_redirect": "Do not automatically redirect to the Web UI",
"external_ca": "External ca setting", "external_ca": "External ca setting",
"setup_adtrust": "Configure AD trust capability",
"external_cert_files": [ "external_cert_files": [
"File containing the IPA CA certificate and the external CA certificate", "File containing the IPA CA certificate and the external CA "
"chain" "certificate chain"
], ],
"reverse_zones": "The reverse DNS zones to use", "reverse_zones": "The reverse DNS zones to use",
"no_reverse": "Do not create new reverse DNS zone", "no_reverse": "Do not create new reverse DNS zone",
@@ -132,8 +131,8 @@ param_docs = {
"debug": "Turn on extra debugging", "debug": "Turn on extra debugging",
"basedn": "The basedn of the IPA server (of the form dc=example,dc=com)", "basedn": "The basedn of the IPA server (of the form dc=example,dc=com)",
"allow_repair": [ "allow_repair": [
"Allow repair of already joined hosts. Contrary to ipaclient_force_join", "Allow repair of already joined hosts. Contrary to "
"the host entry will not be changed on the server" "ipaclient_force_join the host entry will not be changed on the server"
], ],
"backup": "File to backup", "backup": "File to backup",
"fqdn": [ "fqdn": [