Skip to content

Commit

Permalink
fix drain with benefits
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Burd committed Mar 14, 2021
1 parent 62bb199 commit 9139d3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions command/node/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package node
import (
"context"
"fmt"
"reflect"
"sync"
"time"

Expand Down Expand Up @@ -37,6 +36,7 @@ func Drain(c *cli.Context, logger *log.Logger) error {
if c.Bool("force") && c.Bool("no-deadline") {
return fmt.Errorf("-force and -no-deadline are mutually exclusive")
}

if c.String("constraint") != "" {
if c.String("operand") == "" {
return fmt.Errorf("with-benefits constraint provided, must provide new constrain operand")
Expand Down Expand Up @@ -105,7 +105,7 @@ func Drain(c *cli.Context, logger *log.Logger) error {
}

log.Infof("Found Allocation %s, for job %s, moving it", nodeAllocation.ID, nodeAllocation.JobID)
if reflect.DeepEqual(newConstraint, &api.Constraint{}) {
if c.String("constraint") == "" {
evalID, err = stopAllocation(nomadClient, nodeAllocation)
if err != nil {
return err
Expand Down

0 comments on commit 9139d3a

Please sign in to comment.