Skip to content
Snippets Groups Projects
Commit 06381645 authored by Florent Gluck's avatar Florent Gluck
Browse files

liblcient: completed vmStartAttach

parent bce3a39d
Branches
Tags
No related merge requests found
...@@ -3,7 +3,6 @@ package cmdVM ...@@ -3,7 +3,6 @@ package cmdVM
import ( import (
"nexus-client/exec" "nexus-client/exec"
u "nexus-client/utils" u "nexus-client/utils"
g "nexus-libclient/globals"
libclient "nexus-libclient/vm" libclient "nexus-libclient/vm"
) )
...@@ -28,9 +27,6 @@ func (cmd *StartAttach) PrintUsage() { ...@@ -28,9 +27,6 @@ func (cmd *StartAttach) PrintUsage() {
} }
func (cmd *StartAttach) Run(args []string) int { func (cmd *StartAttach) Run(args []string) int {
client := g.GetInstance().Client
host := g.GetInstance().Host
argc := len(args) argc := len(args)
if argc < 1 { if argc < 1 {
cmd.PrintUsage() cmd.PrintUsage()
...@@ -56,20 +52,13 @@ func (cmd *StartAttach) Run(args []string) int { ...@@ -56,20 +52,13 @@ func (cmd *StartAttach) Run(args []string) int {
statusCode := 0 statusCode := 0
for _, vm := range vms { for _, vm := range vms {
uuid := vm.ID.String() err := libclient.VMStart(vm.ID.String())
resp, err := client.R().Put(host + "/vms/" + uuid + "/start")
if err != nil { if err != nil {
u.PrintlnErr("Failed starting VM \"" + vm.Name + "\": " + err.Error()) u.PrintlnErr(err)
statusCode = 1 statusCode = 1
} else { } else {
if resp.IsSuccess() { u.Println("Started VM \"" + vm.Name + "\"")
u.Println("Started VM \"" + vm.Name + "\"")
} else {
u.PrintlnErr("Failed starting VM \"" + vm.Name + "\": " + resp.Status() + ": " + resp.String())
statusCode = 1
}
} }
} }
// at this point, the returned filtered credentials only works for VMs that started successfully // at this point, the returned filtered credentials only works for VMs that started successfully
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment