Add ability to delete multiple snapshots separated by comma

This commit is contained in:
yo
2022-07-14 14:00:41 +02:00
parent 9b86d786fe
commit 99f7bed6f3
2 changed files with 8 additions and 7 deletions

View File

@ -230,10 +230,11 @@ func deleteJailSnapshot(jail Jail) error {
for _, line := range strings.Split(out, "\n") {
if len(line) > 0 {
ls := strings.Split(line, "@")
matched, _ := regexp.Match(fmt.Sprintf("^%s(\\/.*)?$", gSnapshotName), []byte(ls[1]))
if matched {
snaptodel = append(snaptodel, strings.Join(ls, "@"))
for _, sn := range strings.Split(gSnapshotName, ",") {
matched, _ := regexp.Match(fmt.Sprintf("^%s(\\/.*)?$", sn), []byte(ls[1]))
if matched {
snaptodel = append(snaptodel, strings.Join(ls, "@"))
}
}
}
}