diff --git a/changelogs/fragments/add_argument_check_for_rundeck.yaml b/changelogs/fragments/add_argument_check_for_rundeck.yaml new file mode 100644 index 0000000000..7d918d0048 --- /dev/null +++ b/changelogs/fragments/add_argument_check_for_rundeck.yaml @@ -0,0 +1,2 @@ +minor_changes: +- rundeck_acl_policy - add check for rundeck_acl_policy name parameter (https://github.com/ansible-collections/community.general/pull/612). diff --git a/plugins/modules/web_infrastructure/rundeck_acl_policy.py b/plugins/modules/web_infrastructure/rundeck_acl_policy.py index 978e3da1dc..28f287ac73 100644 --- a/plugins/modules/web_infrastructure/rundeck_acl_policy.py +++ b/plugins/modules/web_infrastructure/rundeck_acl_policy.py @@ -118,6 +118,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url, url_argument_spec from ansible.module_utils._text import to_text import json +import re class RundeckACLManager: @@ -230,6 +231,9 @@ def main(): supports_check_mode=True ) + if not bool(re.match("[a-zA-Z0-9,.+_-]+", module.params["name"])): + module.fail_json(msg="Name contains forbidden characters. The policy can contain the characters: a-zA-Z0-9,.+_-") + if module.params["api_version"] < 14: module.fail_json(msg="API version should be at least 14")