Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service: Refactor 'delete_continue' to match other modules. #763

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 3 additions & 14 deletions plugins/modules/ipaservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -317,21 +312,16 @@ 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:
module.fail_json(msg="No name given.")

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))
Expand Down Expand Up @@ -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"]),
Expand All @@ -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
Expand Down