v.0.34 : Jail names can be shortened

This commit is contained in:
yo 2023-07-09 10:38:00 +02:00
parent 5eed121f0b
commit dc4213a8d5
3 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,3 @@
v.0.33b : Support jaling datasets on differents pools : jail_zfs_dataset now have to include the pool name
v.0.33b : Support jailing datasets on differents pools : jail_zfs_dataset now have to include the pool name
v.0.33c : Parallelize start/stop of jails with same priority
v.0.34 : jail name can be shortened

View File

@ -15,7 +15,7 @@ import (
)
const (
gVersion = "0.33c"
gVersion = "0.34"
// TODO : Get from $jail_zpool/defaults.json
MIN_DYN_DEVFS_RULESET = 1000

View File

@ -772,7 +772,8 @@ func getJailFromArray(name string, jarray []Jail) (*Jail, error) {
}
for i, j := range jarray {
if jail == j.Name {
//if jail == j.Name {
if strings.HasPrefix(j.Name, jail) {
if len(ds) > 0 {
if strings.EqualFold(ds, j.Datastore) {
return &jarray[i], nil
@ -786,7 +787,7 @@ func getJailFromArray(name string, jarray []Jail) (*Jail, error) {
}
if len(jails) > 0 {
if len(jails) > 1 {
return &Jail{}, errors.New("More than one jail found with this name, please use datastore/jail format")
return &Jail{}, errors.New("More than one jail matching, please use datastore/jail format or full name")
} else {
return &jails[0], nil
}