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 return
} }
// Get jail by index to modify it cj, err := getJailFromArray(jail.Name, []string{""}, gJails)
for i, _ := range gJails { if err != nil {
if gJails[i].Name == jail.Name { fmt.Printf("Error getting jail %s: %v\n", jail.Name, err)
for _, p := range props { return
err := setStructFieldValue(&gJails[i], p.name, p.value) }
if err != nil {
fmt.Printf("Error: %s\n", err.Error()) for _, p := range props {
return err := setStructFieldValue(cj, p.name, p.value)
} else { if err != nil {
fmt.Printf("%s: %s set to %s\n", gJails[i].Name, p.name, p.value) fmt.Printf("Error: %s\n", err.Error())
gJails[i].ConfigUpdated = true return
} } else {
} fmt.Printf("%s: %s set to %s\n", cj.Name, p.name, p.value)
writeConfigToDisk(&gJails[i], false) cj.ConfigUpdated = true
} }
} }
writeConfigToDisk(cj, false)
} }