make sed template call deprecated

and link to docs
This commit is contained in:
Adrien Delorme 2019-09-20 11:08:15 +02:00
parent adad25b50b
commit df0b06a87a
1 changed files with 9 additions and 0 deletions

View File

@ -40,6 +40,7 @@ var FuncGens = map[string]interface{}{
"packer_version": funcGenPackerVersion,
"consul_key": funcGenConsul,
"vault": funcGenVault,
"sed": funcGenSed,
"replace": replace,
"replace_all": replace_all,
@ -266,6 +267,14 @@ func funcGenVault(ctx *Context) interface{} {
}
}
func funcGenSed(ctx *Context) interface{} {
return func(expression string, inputString string) (string, error) {
return "", errors.New("template function `sed` is deprecated " +
"use `replace` or `replace_all` instead." +
"Documentation: https://www.packer.io/docs/templates/engine.html")
}
}
func replace_all(old, new, src string) string {
return strings.ReplaceAll(src, old, new)
}