From ccaddaf19f0f23e35729ab8b58839151447c8eb3 Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Tue, 24 Dec 2019 20:13:03 +0800 Subject: [PATCH] minor fix --- .../algorithm/predicates/schedtag_helper.go | 2 +- pkg/util/conditionparser/template.go | 14 ++++++++++++++ pkg/util/conditionparser/template_test.go | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/pkg/scheduler/algorithm/predicates/schedtag_helper.go b/pkg/scheduler/algorithm/predicates/schedtag_helper.go index 42d188122d..329281cd40 100644 --- a/pkg/scheduler/algorithm/predicates/schedtag_helper.go +++ b/pkg/scheduler/algorithm/predicates/schedtag_helper.go @@ -219,7 +219,7 @@ func (p *SchedtagChecker) getDynamicSchedtags(resType string, schedDesc *jsonuti tags := []models.SSchedtag{} for _, tag := range dynamicTags { - matched, err := conditionparser.Eval(tag.Condition, schedDesc) + matched, err := conditionparser.EvalBool(tag.Condition, schedDesc) if err != nil { log.Errorf("Condition parse eval: condition: %q, desc: %s, error: %v", tag.Condition, schedDesc, err) continue diff --git a/pkg/util/conditionparser/template.go b/pkg/util/conditionparser/template.go index 312a3bcf4b..f84192d625 100644 --- a/pkg/util/conditionparser/template.go +++ b/pkg/util/conditionparser/template.go @@ -1,3 +1,17 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package conditionparser import ( diff --git a/pkg/util/conditionparser/template_test.go b/pkg/util/conditionparser/template_test.go index 889495ca08..1db4e43739 100644 --- a/pkg/util/conditionparser/template_test.go +++ b/pkg/util/conditionparser/template_test.go @@ -1,3 +1,17 @@ +// Copyright 2019 Yunion +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package conditionparser import (