Fix no-op when set property of a jail with fullname (datastore/jail)

This commit is contained in:
yo 2023-08-26 19:32:34 +02:00
parent ed5f8f0b1c
commit 87e9ae894a

View File

@ -105,20 +105,21 @@ func SetJailProperties(args []string) {
return
}
// Get jail by index to modify it
for i, _ := range gJails {
if gJails[i].Name == jail.Name {
for _, p := range props {
err := setStructFieldValue(&gJails[i], p.name, p.value)
if err != nil {
fmt.Printf("Error: %s\n", err.Error())
return
} else {
fmt.Printf("%s: %s set to %s\n", gJails[i].Name, p.name, p.value)
gJails[i].ConfigUpdated = true
}
}
writeConfigToDisk(&gJails[i], false)
cj, err := getJailFromArray(jail.Name, []string{""}, gJails)
if err != nil {
fmt.Printf("Error getting jail %s: %v\n", jail.Name, err)
return
}
for _, p := range props {
err := setStructFieldValue(cj, p.name, p.value)
if err != nil {
fmt.Printf("Error: %s\n", err.Error())
return
} else {
fmt.Printf("%s: %s set to %s\n", cj.Name, p.name, p.value)
cj.ConfigUpdated = true
}
}
writeConfigToDisk(cj, false)
}