MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / uploadFile

Function uploadFile

src/cmd/linuxkit/push_vcenter.go:90–103  ·  view source on GitHub ↗
(c *govmomi.Client, newVM vmConfig, dss *object.Datastore)

Source from the content-addressed store, hash-verified

88}
89
90func 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}

Callers 1

pushVCenterCmdFunction · 0.85

Calls 1

UploadFileMethod · 0.80

Tested by

no test coverage detected