Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions kubernetes/samples/scripts/common/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ function validateLowerCase {
fi
}

#
# Function to check if a value is a valid WLS domain name.
# must include only alphanumeric characters, hyphens (-)
# or underscore characters (_) and contain at least one letter
# but must start with an alphanumeric or underscore character.
#
# $1 - name of object being checked
# $2 - value to check
validateWlsDomainName() {
echo "validateWlsDomainName called with $2"
if ! [[ "$2" =~ ^[a-z_][a-z0-9_.-]*$ ]] ; then
validationError "$1 with value of $2 is not a valid WebLogic domain name. "\
"A valid WebLogic domain name must include only alphanumeric characters, hyphens (-) "\
"or underscore characters (_) but must start with an alphanumeric or underscore character."
else
if ! [[ "$2" =~ ^.*[a-z0-9].*$ ]] ; then
validationError "$1 with value of $2 is not a valid WebLogic domain name. "\
"A valid WebLogic domain name must contain at least one alphanumeric character."
fi
fi
}

#
# Function to check if a value is lowercase and legal DNS name
# $1 - name of object being checked
Expand Down Expand Up @@ -112,10 +134,13 @@ function validateVersion {

#
# Function to ensure the domain uid is a legal DNS name
# Because the domain uid is also used as a WebLogic domain
# name, it must also be a valid WebLogic domain name.
#
function validateDomainUid {
validateLowerCase "domainUID" ${domainUID}
validateDNS1123LegalName domainUID ${domainUID}
validateLowerCase "domainUID" "${domainUID}"
validateDNS1123LegalName "domainUID" "${domainUID}"
validateWlsDomainName "domainUID" "${domainUID}"
}

#
Expand Down