From 5560ea36f2147d75c7faba8d961fb51ccd632922 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Tue, 8 Feb 2022 09:20:26 -0300 Subject: [PATCH] service: Refactor 'delete_continue' to match other modules. The parameter 'delete_continue' must be supported by several modules, and this patch makes ipaservice module use the same structures as other modules. --- README-service.md | 2 +- plugins/modules/ipaservice.py | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/README-service.md b/README-service.md index 666c189367..acf60c2890 100644 --- a/README-service.md +++ b/README-service.md @@ -310,7 +310,7 @@ Variable | Description | Required `allow_retrieve_keytab_group` \| `ipaallowedtoperform_read_keys_group` | Groups allowed to retrieve a keytab of this host. | no `allow_retrieve_keytab_host` \| `ipaallowedtoperform_read_keys_host` | Hosts allowed to retrieve a keytab from of host. | no `allow_retrieve_keytab_hostgroup` \| `ipaallowedtoperform_read_keys_hostgroup` | Host groups allowed to retrieve a keytab of this host. | no -`continue` | Continuous mode: don't stop on errors. Valid only if `state` is `absent`. Default: `no` (bool) | no +`delete_continue` \| `continue` | Continuous mode: don't stop on errors. Valid only if `state` is `absent`. Default: `no` (bool) | no `smb` | Service is an SMB service. If set, `cifs/` will be prefixed to the service name if needed. | no `netbiosname` | NETBIOS name for the SMB service. Only with `smb: yes`. | no `action` | Work on service or member level. It can be on of `member` or `service` and defaults to `service`. | no diff --git a/plugins/modules/ipaservice.py b/plugins/modules/ipaservice.py index bc73771266..4cd4194b98 100644 --- a/plugins/modules/ipaservice.py +++ b/plugins/modules/ipaservice.py @@ -37,6 +37,7 @@ description: Manage FreeIPA service extends_documentation_fragment: - ipamodule_base_docs + - ipamodule_base_docs.delete_continue options: name: description: The service to manage @@ -142,12 +143,6 @@ required: false type: list aliases: ["ipaallowedtoperform_read_keys_hostgroup"] - continue: - description: - Continuous mode. Don't stop on errors. Valid only if `state` is `absent`. - required: false - default: True - type: bool action: description: Work on service or member level default: service @@ -308,7 +303,7 @@ def check_parameters(module, state, action, names): module.fail_json(msg="Only one service can be added at a time.") if action == 'service': - invalid = ['delete_continue'] + invalid = [] if ( not module.params_get('smb') @@ -317,8 +312,6 @@ def check_parameters(module, state, action, names): module.fail_json( msg="Argument 'netbiosname' can not be used without " "SMB service.") - else: - invalid.append('delete_continue') elif state == 'absent': if len(names) < 1: @@ -326,12 +319,9 @@ def check_parameters(module, state, action, names): if action == "service": invalid.extend(invalid_not_member) - else: - invalid.extend('delete_continue') elif state == 'disabled': invalid.extend(invalid_not_member) - invalid.append('delete_continue') if action != "service": module.fail_json( msg="Invalid action '%s' for state '%s'" % (action, state)) @@ -392,8 +382,6 @@ def init_ansible_module(): allow_retrieve_keytab_hostgroup=dict( type="list", required=False, aliases=['ipaallowedtoperform_read_keys_hostgroup']), - delete_continue=dict(type="bool", required=False, - aliases=['continue']), # action action=dict(type="str", default="service", choices=["member", "service"]), @@ -402,6 +390,7 @@ def init_ansible_module(): choices=["present", "absent", "disabled"]), ), supports_check_mode=True, + ipa_module_options=["delete_continue"], ) ansible_module._ansible_debug = True