mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): avoid hostname has '-' suffix (#18485)
This commit is contained in:
@@ -73,6 +73,9 @@ func (manager *SHostnameResourceBaseManager) ValidateHostname(name string, osTyp
|
||||
input.Hostname = input.Hostname[:15]
|
||||
}
|
||||
}
|
||||
for strings.HasSuffix(input.Hostname, "-") {
|
||||
input.Hostname = strings.TrimSuffix(input.Hostname, "-")
|
||||
}
|
||||
if len(input.Hostname) < 2 {
|
||||
return input, httperrors.NewInputParameterError("the hostname length must be greater than or equal to 2")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user