From df0b06a87a4fc9d2ec6d32a3f493a8943629f197 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Fri, 20 Sep 2019 11:08:15 +0200 Subject: [PATCH] make sed template call deprecated and link to docs --- template/interpolate/funcs.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/template/interpolate/funcs.go b/template/interpolate/funcs.go index 61a8cddf8..eaf2f8e39 100644 --- a/template/interpolate/funcs.go +++ b/template/interpolate/funcs.go @@ -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) }