only build assigned overlays

If a overlay should be build, check if the overlay is assigned to
a node, and return error if otherwise.
This commit is contained in:
Christian Goll
2022-04-26 10:24:52 +02:00
parent c29848171e
commit bfec010e5d
2 changed files with 34 additions and 1 deletions

View File

@@ -72,6 +72,33 @@ func RandomString(n int) string {
return string(b)
}
/*
Checks if given string is in slice. I yes returns true, false otherwise.
*/
func InSlice(slice []string, match string) bool {
for _, val := range slice {
if val == match {
return true
}
}
return false
}
/*
Checks if one or more elements of a slice A are a part of slice B. Returns true
as soon as one element matches.\
*/
func SliceInSlice(A []string, B []string) bool {
for _, a := range A {
for _, b := range B {
if a == b {
return true
}
}
}
return false
}
func IsDir(path string) bool {
wwlog.Printf(wwlog.DEBUG, "Checking if path exists as a directory: %s\n", path)