Skip to content

Commit

Permalink
Fixed several errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Font committed Feb 17, 2021
1 parent c1a9ae0 commit e9c723f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion driver/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ func (d *Driver) getVApp() (*govcd.VApp, error) {
}

if d.VAppHREF != "" { // this is way quicker
log.Infof("Fetching vApp the quick way")
vapp := govcd.NewVApp(&client.Client)
vapp.VApp.HREF = d.VAppHREF
err = vapp.Refresh()
if err != nil {
return nil, err
}
return vapp, nil
}

log.Infof("Trying alternative method to fetch the vApp...")
Expand All @@ -92,12 +94,14 @@ func (d *Driver) getVM() (*govcd.VM, error) {
return nil, err
}
if d.VMHREF != "" {
log.Infof("Fetching VM the quick way")
vm := govcd.NewVM(&client.Client)
vm.VM.HREF = d.VMHREF
err = vm.Refresh()
if err != nil {
return vm, nil
return nil, err
}
return vm, nil
}

log.Infof("Trying alternative method to fetch the VM...")
Expand Down
2 changes: 2 additions & 0 deletions driver/vcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (d *Driver) Create() error {
if err != nil {
return err
}
d.VAppHREF = vapp.VApp.HREF

if len(vapp.VApp.Children.VM) != 1 {
return fmt.Errorf("VM count != 1")
Expand All @@ -155,6 +156,7 @@ func (d *Driver) Create() error {
return err
}
log.Infof("Found VM: %s...", vm.VM.Name)
d.VMHREF = vm.VM.HREF

cWait := make(chan string, 1)
go func() {
Expand Down

0 comments on commit e9c723f

Please sign in to comment.