redhat-cop / redhat-cop/ocp4-helpernode
Improve validate_host_names.yaml
Nobody has claimed this yet.
- Dominant language
- Jinja
- Stars
- 358
- Forks
- 308
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tasks/validate_host_names.yaml and vars/main.yml, comparing the current CHARS and when expression with the requested ValidHostnameRegex and search condition. Done means host validation is clearer and also covers IP addresses; confirm whether MAC validation and the validate.yaml split are in scope before changing them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100