(c *govmomi.Client, newVM vmConfig, dss *object.Datastore)
| 88 | } |
| 89 | |
| 90 | func uploadFile(c *govmomi.Client, newVM vmConfig, dss *object.Datastore) { |
| 91 | _, fileName := path.Split(*newVM.path) |
| 92 | log.Infof("Uploading LinuxKit file [%s]", *newVM.path) |
| 93 | if *newVM.path == "" { |
| 94 | log.Fatalf("No file specified") |
| 95 | } |
| 96 | dsurl := dss.NewURL(fmt.Sprintf("%s/%s", *newVM.vmFolder, fileName)) |
| 97 | |
| 98 | p := soap.DefaultUpload |
| 99 | ctx := context.Background() |
| 100 | if err := c.UploadFile(ctx, *newVM.path, dsurl, &p); err != nil { |
| 101 | log.Fatalf("Unable to upload file to vCenter Datastore\n%v", err) |
| 102 | } |
| 103 | } |
no test coverage detected