ocp4-helpernode
ocp4-helpernode copied to clipboard
Improve validate_host_names.yaml
We should improve validate_host_names.yaml by making it clearer to match the regex for a valid internet host and then fail.
- Change CHARS to
ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
- Change the "when" to
item is search('{{ ValidHostnameRegex }}')
- Add IP address validation (based on this stackoverflow)
Another thing that can be done is validate the Mac Address as well
We should also probably change the name of validate_host_names.yaml
to validate.yaml
for generic validations. We could also break them up into individual files. I'm open for suggestions on that front.