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
|
|
@ -30,6 +30,8 @@ type StartVMCommand struct {
|
|||
SSHKey string
|
||||
}
|
||||
|
||||
func (c StartVMCommand) Key() string { return "vm/" + c.Name }
|
||||
|
||||
func (c StartVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
||||
if _, err := kv.GetFromDB(db, "vm/"+c.Name+"/state"); err == nil {
|
||||
return fmt.Errorf("vm %q already exists", c.Name)
|
||||
|
|
@ -111,6 +113,8 @@ type StopVMCommand struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
func (c StopVMCommand) Key() string { return "vm/" + c.Name }
|
||||
|
||||
func (c StopVMCommand) Prepare(db *badger.DB, _ *configuration.Config) error {
|
||||
if _, err := kv.GetFromDB(db, "vm/"+c.Name+"/state"); err != nil {
|
||||
return fmt.Errorf("vm %q not found", c.Name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue