Do not support 2 jails with same name, only keep the first seen
This commit is contained in:
parent
249ab19173
commit
57c8bba09b
@ -220,6 +220,15 @@ func listJailsFromDirectory(dir string) []Jail {
|
||||
j.Zpool = strings.Split(strings.TrimSuffix(out, "\n"), "/")[0]
|
||||
}
|
||||
|
||||
// Check if jail with the same name already exist on another DS
|
||||
for _, jj := range gJails {
|
||||
if strings.EqualFold(jj.Name, j.Name) {
|
||||
fmt.Printf("ERROR: A jail with name %s already exist on datastore %s!\n", j.Name, jj.Zpool)
|
||||
fmt.Printf("Jail %s on datastore %s wont be handled\n", j.Name, j.Zpool)
|
||||
return gJails
|
||||
}
|
||||
}
|
||||
|
||||
gJails = append(gJails, j)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user