-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from shalb/tainted-graph-ref
Tainted units, graph refactoring, fixes
- Loading branch information
Showing
31 changed files
with
1,165 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package config | ||
|
||
import "strings" | ||
|
||
type TargetUnits []string | ||
|
||
func NewTargetsChecker(tg []string) *TargetUnits { | ||
res := TargetUnits{} | ||
res = append(res, tg...) | ||
return &res | ||
} | ||
|
||
func (t *TargetUnits) Check(unitKey string) bool { | ||
for _, target := range *t { | ||
tgSplitted := strings.Split(target, ".") | ||
uKeySplitted := strings.Split(unitKey, ".") | ||
if len(tgSplitted) == 0 || len(tgSplitted) > 2 || len(uKeySplitted) != 2 { | ||
return false | ||
} | ||
if len(tgSplitted) == 1 { | ||
// Target is whole stack, check unit stack name only. | ||
if uKeySplitted[0] == tgSplitted[0] { | ||
return true | ||
} | ||
continue | ||
} | ||
// The target is unit, compare unit name and stack name. | ||
if uKeySplitted[0] == tgSplitted[0] && uKeySplitted[1] == tgSplitted[1] { | ||
return false | ||
} | ||
} | ||
return false | ||
} |
Oops, something went wrong.