Skip to content

Commit

Permalink
[driver vbox] rename func VBoxManage > vBoxManage
Browse files Browse the repository at this point in the history
  • Loading branch information
remimendes committed Sep 12, 2023
1 parent 3ab58d6 commit d753298
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions drivers/rescontainervbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (t *T) ToSync() []string {
return []string{}
}

func (t *T) VBoxManageCommand(args ...string) (string, error) {
func (t *T) vBoxManageCommand(args ...string) (string, error) {
cmd := command.New(
command.WithName("VBoxManage"),
command.WithArgs(args),
Expand Down Expand Up @@ -265,7 +265,7 @@ func (t *T) readConfigFileFromVarDir() (string, error) {

func (t *T) configFile() string {
t.Log().Info().Msgf("VBoxManage showvminfo --machinereadable %s", t.Name)
b, err := t.VBoxManageCommand("showvminfo", "--machinereadable", t.Name)
b, err := t.vBoxManageCommand("showvminfo", "--machinereadable", t.Name)
if err != nil {
t.Log().Error().Msgf("can't find config file: %s", err)
return ""
Expand Down Expand Up @@ -345,19 +345,19 @@ func (t *T) undefine() error {

func (t *T) start() error {
t.Log().Info().Msgf("VBoxManage startvm %s --type=headless", t.Name)
_, err := t.VBoxManageCommand("startvm", t.Name, "--type=headless")
_, err := t.vBoxManageCommand("startvm", t.Name, "--type=headless")
return err
}

func (t *T) stop() error {
t.Log().Info().Msgf("VBoxManage controlvm %s acpipowerbutton", t.Name)
_, err := t.VBoxManageCommand("controlvm", t.Name, "acpipowerbutton")
_, err := t.vBoxManageCommand("controlvm", t.Name, "acpipowerbutton")
return err
}

func (t *T) destroy() error {
t.Log().Info().Msgf("VBoxManage controlvm %s poweroff", t.Name)
_, err := t.VBoxManageCommand("controlvm", t.Name, "poweroff")
_, err := t.vBoxManageCommand("controlvm", t.Name, "poweroff")
return err
}

Expand Down Expand Up @@ -402,8 +402,11 @@ func (t *T) registerVm() error {
if err != nil {
return err
}
if configFilePath == "" {
return fmt.Errorf("can't register: vm unknown config file path")
}
t.Log().Info().Msgf("VBoxManage registervm %s", configFilePath)
_, err = t.VBoxManageCommand("registervm", configFilePath)
_, err = t.vBoxManageCommand("registervm", configFilePath)
return err
}

Expand Down Expand Up @@ -469,7 +472,7 @@ func isAbortedFromState(state string) bool {

func (t *T) domState() (string, error) {
t.Log().Debug().Msgf("VBoxManage showvminfo --machinereadable %s", t.Name)
s, err := t.VBoxManageCommand("showvminfo", "--machinereadable", t.Name)
s, err := t.vBoxManageCommand("showvminfo", "--machinereadable", t.Name)
if err != nil {
return "", err
}
Expand Down

0 comments on commit d753298

Please sign in to comment.