(flags *pflag.FlagSet, placement *swarm.Placement)
| 622 | } |
| 623 | |
| 624 | func updatePlacementConstraints(flags *pflag.FlagSet, placement *swarm.Placement) { |
| 625 | if flags.Changed(flagConstraintAdd) { |
| 626 | values := flags.Lookup(flagConstraintAdd).Value.(*opts.ListOpts).GetSlice() |
| 627 | placement.Constraints = append(placement.Constraints, values...) |
| 628 | } |
| 629 | toRemove := buildToRemoveSet(flags, flagConstraintRemove) |
| 630 | |
| 631 | newConstraints := []string{} |
| 632 | for _, constraint := range placement.Constraints { |
| 633 | if _, exists := toRemove[constraint]; !exists { |
| 634 | newConstraints = append(newConstraints, constraint) |
| 635 | } |
| 636 | } |
| 637 | // Sort so that result is predictable. |
| 638 | sort.Strings(newConstraints) |
| 639 | |
| 640 | placement.Constraints = newConstraints |
| 641 | } |
| 642 | |
| 643 | func updatePlacementPreferences(flags *pflag.FlagSet, placement *swarm.Placement) { |
| 644 | var newPrefs []swarm.PlacementPreference |
searching dependent graphs…