f-37: code: add state error in return nil #37
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
3edc319969
commit
fa72b6cd47
4 changed files with 18 additions and 0 deletions
|
|
@ -17,6 +17,8 @@ type CreateVPCCommand struct {
|
|||
CIDR string
|
||||
}
|
||||
|
||||
func (c CreateVPCCommand) Key() string { return "vpc/" + c.Name }
|
||||
|
||||
func (c CreateVPCCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
||||
if _, err := kv.GetFromDB(db, "vpc/"+c.Name+"/state"); err == nil {
|
||||
return fmt.Errorf("vpc %q already exists", c.Name)
|
||||
|
|
@ -38,6 +40,8 @@ type DeleteVPCCommand struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
func (c DeleteVPCCommand) Key() string { return "vpc/" + c.Name }
|
||||
|
||||
func (c DeleteVPCCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
||||
if _, err := kv.GetFromDB(db, "vpc/"+c.Name+"/state"); err != nil {
|
||||
return fmt.Errorf("vpc %q not found", c.Name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue