-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USHIFT-1545: Full VM name validation #3672
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. In 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -227,6 +269,8 @@ prepare_kickstart() { | |||
local -r vm_hostname="${full_vmname/./-}" | |||
local -r hostname=$(hostname) | |||
|
|||
validate_full_vm_name $full_vmname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, however this check has explicit error message about what is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Needs 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. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.