ocp4-helpernode icon indicating copy to clipboard operation
ocp4-helpernode copied to clipboard

Improve validate_host_names.yaml

Open christianh814 opened this issue 3 years ago • 0 comments

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.

christianh814 avatar Feb 10 '22 16:02 christianh814