getJailFromArray filtering by type
This commit is contained in:
@ -3,13 +3,14 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
//"log"
|
||||
"time"
|
||||
//"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func DestroyJails(args []string) {
|
||||
for _, a := range args {
|
||||
cj, err := getJailFromArray(a, gJails)
|
||||
cj, err := getJailFromArray(a, []string{""}, gJails)
|
||||
if err != nil {
|
||||
fmt.Printf("Error getting jail: %s\n", err)
|
||||
return
|
||||
@ -27,6 +28,8 @@ func DestroyJails(args []string) {
|
||||
}
|
||||
fmt.Printf("Stopping jail %s\n", cj.Name)
|
||||
StopJail([]string{fmt.Sprintf("%s/%s", cj.Datastore, cj.Name)})
|
||||
// Give some time to the host OS to free all mounts accessing processes
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
// Get root and config datasets, then destroy
|
||||
@ -51,7 +54,6 @@ func DestroyJails(args []string) {
|
||||
fmt.Printf("Error deleting config dataset: %s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
//TODO: Delete jail named directory
|
||||
fmt.Printf("Jail %s is no more!\n", cj.Name)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user