Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "core: Add uuid() interpolate function." #5644

Merged
merged 1 commit into from
Mar 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions config/interpolate_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"strings"

"github.com/apparentlymart/go-cidr/cidr"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/hil/ast"
"github.com/mitchellh/go-homedir"
)
Expand All @@ -43,7 +42,6 @@ func Funcs() map[string]ast.Function {
"length": interpolationFuncLength(),
"lower": interpolationFuncLower(),
"md5": interpolationFuncMd5(),
"uuid": interpolationFuncUUID(),
"replace": interpolationFuncReplace(),
"sha1": interpolationFuncSha1(),
"sha256": interpolationFuncSha256(),
Expand Down Expand Up @@ -684,13 +682,3 @@ func interpolationFuncBase64Sha256() ast.Function {
},
}
}

func interpolationFuncUUID() ast.Function {
return ast.Function{
ArgTypes: []ast.Type{},
ReturnType: ast.TypeString,
Callback: func(args []interface{}) (interface{}, error) {
return uuid.GenerateUUID()
},
}
}
22 changes: 0 additions & 22 deletions config/interpolate_funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,28 +945,6 @@ func TestInterpolateFuncMd5(t *testing.T) {
})
}

func TestInterpolateFuncUUID(t *testing.T) {
results := make(map[string]bool)

for i := 0; i < 100; i++ {
ast, err := hil.Parse("${uuid()}")
if err != nil {
t.Fatalf("err: %s", err)
}

out, _, err := hil.Eval(ast, langEvalConfig(nil))
if err != nil {
t.Fatalf("err: %s", err)
}

if results[out.(string)] {
t.Fatalf("Got unexpected duplicate uuid: %s", out)
}

results[out.(string)] = true
}
}

type testFunctionConfig struct {
Cases []testFunctionCase
Vars map[string]ast.Variable
Expand Down
Loading