Skip to content

Commit

Permalink
fix: add remote iso to content library
Browse files Browse the repository at this point in the history
Adds support to import a remote ISO file by allowing vCenter Server to pull the file from the HTTP/HTTPS endpoint.

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
  • Loading branch information
tenthirtyam committed Aug 21, 2024
1 parent 0a41cd6 commit 2a24f18
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vsphere/internal/helper/contentlibrary/content_library_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ func CreateLibraryItem(c *rest.Client, l *library.Library, name string, desc str
return &id, uploadSession.deployRemoteOva(file, ovfDescriptor)
case !isLocal && !isOva:
return &id, uploadSession.deployRemoteOvf(file)
case !isLocal && isIso:
return &id, uploadSession.deployRemoteIso(file)
}

log.Printf("[DEBUG] contentlibrary.CreateLibraryItem: Successfully created content library item %s.", name)
Expand Down Expand Up @@ -255,6 +257,15 @@ func (uploadSession *libraryUploadSession) deployRemoteOva(file string, ovfDescr
return nil
}

func (uploadSession *libraryUploadSession) deployRemoteIso(file string) error {
ctx := context.TODO()
_, err := uploadSession.ContentLibraryManager.AddLibraryItemFileFromURI(ctx, uploadSession.UploadSession, filepath.Base(file), file)
if err != nil {
return err
}
return uploadSession.ContentLibraryManager.WaitOnLibraryItemUpdateSession(ctx, uploadSession.UploadSession, time.Second*60, func() { log.Printf("Waiting...") })
}

func (uploadSession *libraryUploadSession) deployLocalOvf(file string, ovfDescriptor string) error {
e, err := readEnvelope(ovfDescriptor)
if err != nil {
Expand Down

0 comments on commit 2a24f18

Please sign in to comment.