USHIFT-1545: Full VM name validation#3672
USHIFT-1545: Full VM name validation#3672openshift-merge-bot[bot] merged 4 commits intoopenshift:mainfrom
Conversation
|
@vanhalenar: This pull request references USHIFT-1545 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.17.0" version, but no target version was set. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
test/bin/scenario.sh
Outdated
|
|
||
| if [ -z "${vm_name}" ]; then | ||
| error "VM hostname cannot be empty string" | ||
| record_junit "${vmname}" "vm_name_validation" "FAILED" |
There was a problem hiding this comment.
Similar thing in other places
| record_junit "${vmname}" "vm_name_validation" "FAILED" | |
| record_junit "${vm_name}" "vm_name_validation" "FAILED" |
test/bin/scenario.sh
Outdated
| local -r vm_hostname="${full_vmname/./-}" | ||
| local -r hostname=$(hostname) | ||
|
|
||
| validate_full_vm_name $full_vmname |
There was a problem hiding this comment.
I think we want to validate vm_hostname since it'll be used for hostname.
| validate_full_vm_name $full_vmname | |
| validate_full_vm_name "${vm_hostname}" |
test/bin/scenario.sh
Outdated
| fi | ||
|
|
||
| # split by '.' and check every section separately | ||
| IFS='.' read -ra ARR <<< "$vm_name" |
There was a problem hiding this comment.
If we validate $vm_hostname instead of $full_vmname, then we can remove this loop and flatten and merge the checks.
test/bin/scenario.sh
Outdated
| if [[ "${vm_name}" =~ ^\. ]]; then | ||
| error "VM hostname cannot start with '.'" | ||
| record_junit "${vm_name}" "vm_hostname_validation" "FAILED" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
Do we need this check? I mean if the name starts from ., wouldn't the next check fail?
There was a problem hiding this comment.
Yes, however this check has explicit error message about what is wrong
There was a problem hiding this comment.
On the other hand: before passing the hostname to this function, we replace all . with -, so this won't be executed unless we do some refactoring and mess up
There was a problem hiding this comment.
Okay, I removed it
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ggiguash, vanhalenar The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@vanhalenar: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.