lifecycle: Consider multiple tags filtering (#9775)

* lifecycle: Consider multiple tags filtering
* lifecycle: Disallow duplicated Key/Value xml in <Tag>
This commit is contained in:
Anis Elleuch
2020-06-05 18:30:10 +01:00
committed by GitHub
parent 4dd07e5763
commit e906b511e9
4 changed files with 109 additions and 11 deletions

View File

@@ -104,15 +104,12 @@ func (lc Lifecycle) FilterActionableRules(objName, objTags string) []Rule {
if rule.Status == Disabled {
continue
}
if strings.HasPrefix(objName, rule.Prefix()) {
tags := rule.Tags()
if tags != "" {
if strings.Contains(objTags, tags) {
rules = append(rules, rule)
}
} else {
rules = append(rules, rule)
}
if !strings.HasPrefix(objName, rule.Prefix()) {
continue
}
tags := strings.Split(objTags, "&")
if rule.Filter.TestTags(tags) {
rules = append(rules, rule)
}
}
return rules