mirror of https://github.com/docker/docs.git
expr: Get rid of MatchEmpty.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
fc192b7077
commit
04fc1ab997
|
@ -34,8 +34,13 @@ func (f *ConstraintFilter) Filter(config *dockerclient.ContainerConfig, nodes []
|
||||||
if constraint.Match(label) {
|
if constraint.Match(label) {
|
||||||
candidates = append(candidates, node)
|
candidates = append(candidates, node)
|
||||||
}
|
}
|
||||||
} else if constraint.MatchEmpty() {
|
} else {
|
||||||
candidates = append(candidates, node)
|
// The node doesn't have this particular label.
|
||||||
|
if constraint.operator == NOTEQ {
|
||||||
|
// Special case: If the operator is != and the node doesn't
|
||||||
|
// have the label at all, consider it as a candidate.
|
||||||
|
candidates = append(candidates, node)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,10 +72,6 @@ func parseExprs(key string, env []string) ([]expr, error) {
|
||||||
return exprs, nil
|
return exprs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *expr) MatchEmpty() bool {
|
|
||||||
return e.operator == NOTEQ
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *expr) Match(whats ...string) bool {
|
func (e *expr) Match(whats ...string) bool {
|
||||||
var (
|
var (
|
||||||
pattern string
|
pattern string
|
||||||
|
|
Loading…
Reference in New Issue