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

nexush: fixed bug introduced in the last commit where some garbage characters...

nexush: fixed bug introduced in the last commit where some garbage characters were commited in the source code. Also vmlist and usersetcaps commands were removed by accident.
Fixed ticket:  "préfixer le n° de VM lors de création multiples"
parent c0a1a328
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ package cmdVM ...@@ -2,6 +2,7 @@ package cmdVM
import ( import (
"os" "os"
"fmt"
"errors" "errors"
"strconv" "strconv"
"encoding/csv" "encoding/csv"
...@@ -111,11 +112,13 @@ func (cmd *Create)Run(args []string) int { ...@@ -111,11 +112,13 @@ func (cmd *Create)Run(args []string) int {
} }
statusCode := 0 statusCode := 0
digits := len(strconv.Itoa(count))
for i := 1; i <= count; i++ { for i := 1; i <= count; i++ {
if csvEntries == nil { if csvEntries == nil {
if count > 1 { if count > 1 {
vmArgs.Name = name+" ["+strconv.Itoa(i)+"]" numberPadded := fmt.Sprintf("%0"+strconv.Itoa(digits)+"d", i)
vmArgs.Name = name+" ["+numberPadded+"]"
} }
} else { } else {
vmArgs.Name = name+" ["+csvEntries[i-1]+"]" vmArgs.Name = name+" ["+csvEntries[i-1]+"]"
......
...@@ -28,7 +28,10 @@ var cmdList = []cmd.Command { ...@@ -28,7 +28,10 @@ var cmdList = []cmd.Command {
&cmdUser.UpdatePwd{"passwd"}, &cmdUser.UpdatePwd{"passwd"},
&cmdUser.List{"userlist"}, &cmdUser.List{"userlist"},
&cmdUser.Add{"useradd"}, &cmdUser.Add{"useradd"},
&cmdUser.Del{"userdel"},PrintlnErr &cmdUser.Del{"userdel"},
&cmdUser.SetCaps{"usersetcaps"},
&cmdVM.List{"vmlist"},
&cmdVM.ListStart{"vmliststart"}, &cmdVM.ListStart{"vmliststart"},
&cmdVM.ListAttach{"vmlistattach"}, &cmdVM.ListAttach{"vmlistattach"},
&cmdVM.ListStop{"vmliststop"}, &cmdVM.ListStop{"vmliststop"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment