Skip to content

Commit

Permalink
Add task to validate xnat_config.site_name (#84)
Browse files Browse the repository at this point in the history
Fixes #76 

- check that `xnat_config.site_name` starts with a letter and contains
only letters, numbers, and underscores

---------

Co-authored-by: Patrick J. Roddy <[email protected]>
  • Loading branch information
p-j-smith and paddyroddy authored Mar 25, 2024
1 parent 4274fd2 commit 8e8d97c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/xnat/tasks/settings_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
force: true
notify: Restart tomcat

- name: "Validate xnat_config.site_name: {{ xnat_config.site_name }}"
ansible.builtin.assert:
that:
- xnat_config.site_name is match('^[A-Za-z][A-Za-z0-9_]*$')
fail_msg: >
xnat_config.site_name must start with a letter and contain only
letters, numbers, and underscores
success_msg: xnat_config.site_name is valid

- name: "Configure prefs-init"
ansible.builtin.template:
src: "prefs-init.j2"
Expand Down

0 comments on commit 8e8d97c

Please sign in to comment.