From 7929ee76dcf5fd748b8edcf1834deb9bebb17e45 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 26 Jan 2016 12:11:02 -0800 Subject: [PATCH] Change the unique namespace on the node --- nomad/structs/node_class.go | 2 +- scheduler/feasible.go | 4 ++-- scheduler/feasible_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nomad/structs/node_class.go b/nomad/structs/node_class.go index 8c020f299..eb1f1a703 100644 --- a/nomad/structs/node_class.go +++ b/nomad/structs/node_class.go @@ -82,7 +82,7 @@ func EscapedConstraints(constraints []*Constraint) []*Constraint { // computed node class optimization. func constraintTargetEscapes(target string) bool { switch { - case strings.HasPrefix(target, "$unique."): + case strings.HasPrefix(target, "$node.unique."): return true case strings.HasPrefix(target, "$attr."): diff --git a/scheduler/feasible.go b/scheduler/feasible.go index 8d9c55c4f..3d8eda1df 100644 --- a/scheduler/feasible.go +++ b/scheduler/feasible.go @@ -296,13 +296,13 @@ func resolveConstraintTarget(target string, node *structs.Node) (interface{}, bo // Handle the interpolations switch { - case "$unique.node.id" == target: + case "$node.unique.id" == target: return node.ID, true case "$node.datacenter" == target: return node.Datacenter, true - case "$unique.node.name" == target: + case "$node.unique.name" == target: return node.Name, true case "$node.class" == target: diff --git a/scheduler/feasible_test.go b/scheduler/feasible_test.go index 381893097..d72e2f5d0 100644 --- a/scheduler/feasible_test.go +++ b/scheduler/feasible_test.go @@ -189,7 +189,7 @@ func TestResolveConstraintTarget(t *testing.T) { node := mock.Node() cases := []tcase{ { - target: "$unique.node.id", + target: "$node.unique.id", node: node, val: node.ID, result: true, @@ -201,7 +201,7 @@ func TestResolveConstraintTarget(t *testing.T) { result: true, }, { - target: "$unique.node.name", + target: "$node.unique.name", node: node, val: node.Name, result: true,