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

liblcient: completed vmStartAttach

parent bce3a39d
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@ package cmdVM
import (
"nexus-client/exec"
u "nexus-client/utils"
g "nexus-libclient/globals"
libclient "nexus-libclient/vm"
)
......@@ -28,9 +27,6 @@ func (cmd *StartAttach) PrintUsage() {
}
func (cmd *StartAttach) Run(args []string) int {
client := g.GetInstance().Client
host := g.GetInstance().Host
argc := len(args)
if argc < 1 {
cmd.PrintUsage()
......@@ -56,20 +52,13 @@ func (cmd *StartAttach) Run(args []string) int {
statusCode := 0
for _, vm := range vms {
uuid := vm.ID.String()
resp, err := client.R().Put(host + "/vms/" + uuid + "/start")
err := libclient.VMStart(vm.ID.String())
if err != nil {
u.PrintlnErr("Failed starting VM \"" + vm.Name + "\": " + err.Error())
u.PrintlnErr(err)
statusCode = 1
} else {
if resp.IsSuccess() {
u.Println("Started VM \"" + vm.Name + "\"")
} else {
u.PrintlnErr("Failed starting VM \"" + vm.Name + "\": " + resp.Status() + ": " + resp.String())
statusCode = 1
}
u.Println("Started VM \"" + vm.Name + "\"")
}
}
// 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