mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
Change the unique namespace on the node
This commit is contained in:
@@ -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."):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user