f-37: code: add state error in return nil #37

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-08-13 23:12:32 +02:00
commit fa72b6cd47
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
4 changed files with 18 additions and 0 deletions

View file

@ -22,6 +22,8 @@ type CreateSubnetCommand struct {
DefaultRoute bool
}
func (c CreateSubnetCommand) Key() string { return "subnet/" + c.Name }
func (c CreateSubnetCommand) Prepare(db *badger.DB, cfg *configuration.Config) error {
if c.Mode == "" {
c.Mode = "vxlan"
@ -79,6 +81,8 @@ type DeleteSubnetCommand struct {
Name string
}
func (c DeleteSubnetCommand) Key() string { return "subnet/" + c.Name }
func (c DeleteSubnetCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
if _, err := kv.GetFromDB(db, "subnet/"+c.Name+"/state"); err != nil {
return fmt.Errorf("subnet %q not found", c.Name)