mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 22:03:18 +00:00
ipaconfig: Validate emaildomain
When setting the default email domain, there was no validation on the provide value. Using ipapython.validate.Email applies the same validation method as implemented in IPA. Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
This commit is contained in:
@@ -344,7 +344,7 @@ config:
|
||||
|
||||
|
||||
from ansible.module_utils.ansible_freeipa_module import \
|
||||
IPAAnsibleModule, compare_args_ipa, ipalib_errors
|
||||
IPAAnsibleModule, compare_args_ipa, ipalib_errors, Email
|
||||
|
||||
|
||||
def config_show(module):
|
||||
@@ -515,6 +515,13 @@ def main():
|
||||
msg="Argument '%s' must be between %d and %d."
|
||||
% (arg, minimum, maximum))
|
||||
|
||||
# verify email domain
|
||||
emaildomain = params.get("ipadefaultemaildomain", None)
|
||||
if emaildomain:
|
||||
if not Email("test@{0}".format(emaildomain)):
|
||||
ansible_module.fail_json(
|
||||
msg="Invalid 'emaildomain' value: %s" % emaildomain)
|
||||
|
||||
changed = False
|
||||
exit_args = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user