Skip to content

Commit

Permalink
[fix] Fixing failing unit tests (hashicorp#2108)
Browse files Browse the repository at this point in the history
Datastore ds.URL method was removed as deprecated in vmware govmomi
lib in favour of ds.NewURL but usages in code were not removed causing
unit tests to start failing after the upgrade to govmomi v0.34.2 with:
Error: vsphere/resource_vsphere_file.go:152:19: ds.URL undefined (type *object.Datastore has no field or method URL)

Updated the usages of the deprecated method with the recommended one

Testing done:

Executed `make test` without errors

Signed-off-by: Vasil Atanasov <[email protected]>
  • Loading branch information
vasilsatanasov authored Jan 11, 2024
1 parent ee67040 commit 9c7a3b5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vsphere/resource_vsphere_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,10 @@ func createDirectory(datastoreFileManager *object.DatastoreFileManager, f *file)

// fileUpload - upload file to a vSphere datastore
func fileUpload(client *govmomi.Client, dc *object.Datacenter, ds *object.Datastore, source, destination string) error {
dsurl, err := ds.URL(context.TODO(), dc, destination)
if err != nil {
return err
}
dsurl := ds.NewURL(destination)

p := soap.DefaultUpload
err = client.Client.UploadFile(context.TODO(), source, dsurl, &p)
err := client.Client.UploadFile(context.TODO(), source, dsurl, &p)
if err != nil {
return err
}
Expand Down

0 comments on commit 9c7a3b5

Please sign in to comment.