yandex: use clean_resource_name too

This commit is contained in:
Adrien Delorme 2019-10-04 11:31:33 +02:00
parent d4600a7716
commit 3a4079f97a
1 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,9 @@
package yandex package yandex
import "strings" import (
import "text/template" "strings"
"text/template"
)
func isalphanumeric(b byte) bool { func isalphanumeric(b byte) bool {
if '0' <= b && b <= '9' { if '0' <= b && b <= '9' {
@ -13,9 +15,9 @@ func isalphanumeric(b byte) bool {
return false return false
} }
// Clean up image name by replacing invalid characters with "-" // Clean up resource name by replacing invalid characters with "-"
// and converting upper cases to lower cases // and converting upper cases to lower cases
func templateCleanImageName(s string) string { func templateCleanResourceName(s string) string {
if reImageFamily.MatchString(s) { if reImageFamily.MatchString(s) {
return s return s
} }
@ -32,5 +34,5 @@ func templateCleanImageName(s string) string {
} }
var TemplateFuncs = template.FuncMap{ var TemplateFuncs = template.FuncMap{
"clean_image_name": templateCleanImageName, "clean_resource_name": templateCleanResourceName,
} }