From c5647dc0461848d91f9c46d3de9c5aa9bab0dc11 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Fri, 2 Sep 2016 15:20:03 -0500 Subject: [PATCH] Revert "providers/template: template_file supports floating point math" --- .../template/datasource_template_file.go | 16 ++-------------- .../template/datasource_template_file_test.go | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/builtin/providers/template/datasource_template_file.go b/builtin/providers/template/datasource_template_file.go index ed5aa3517..6a04ccfca 100644 --- a/builtin/providers/template/datasource_template_file.go +++ b/builtin/providers/template/datasource_template_file.go @@ -6,7 +6,6 @@ import ( "fmt" "os" "path/filepath" - "strconv" "strings" "github.com/hashicorp/hil" @@ -117,20 +116,9 @@ func execute(s string, vars map[string]interface{}) (string, error) { if !ok { return "", fmt.Errorf("unexpected type for variable %q: %T", k, v) } - - // Store the defaults (string and value) - var val interface{} = s - typ := ast.TypeString - - // If we can parse a float, then use that - if v, err := strconv.ParseFloat(s, 64); err == nil { - val = v - typ = ast.TypeFloat - } - varmap[k] = ast.Variable{ - Value: val, - Type: typ, + Value: s, + Type: ast.TypeString, } } diff --git a/builtin/providers/template/datasource_template_file_test.go b/builtin/providers/template/datasource_template_file_test.go index f213cb5ba..43dda582c 100644 --- a/builtin/providers/template/datasource_template_file_test.go +++ b/builtin/providers/template/datasource_template_file_test.go @@ -26,8 +26,6 @@ func TestTemplateRendering(t *testing.T) { {`{a="foo"}`, `$${a}`, `foo`}, {`{a="hello"}`, `$${replace(a, "ello", "i")}`, `hi`}, {`{}`, `${1+2+3}`, `6`}, - {`{a=1, b=2}`, `$${a+b}`, `3`}, - {`{a=0.1, b=0.2}`, `$${0+((a+b)*10)}`, `3`}, } for _, tt := range cases {