Skip to content

Commit

Permalink
Fix stemcells with non-standard OVF names
Browse files Browse the repository at this point in the history
- Stemcells from stembuild have OVFs named stembuild_target.ovf instead of image.ovf
  • Loading branch information
Micah Young committed May 1, 2020
1 parent a30c288 commit 980dcd0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/bosh-vmrun-cpi/stemcell/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ func (c StemcellClientImpl) ExtractOvf(stemcellTarballPath string) (string, erro
return "", bosherr.WrapErrorf(err, "Unpacking outer stemcell tarball '%s' to '%s'", stemcellTarballPath, c.parentTempDir)
}

imageOvfPath := filepath.Join(c.parentTempDir, "image.ovf")
if !c.fs.FileExists(imageOvfPath) {
return "", bosherr.Error("stemcell does not contain 'image.ovf'")
matches, err := filepath.Glob(filepath.Join(c.parentTempDir, "*.ovf"))
if err != nil {
return "", err
}

if len(matches) != 1 {
return "", bosherr.Error("stemcell does not contain a single ovf")
}

return imageOvfPath, nil
return matches[0], nil
}

func (c StemcellClientImpl) Cleanup() {
Expand Down

0 comments on commit 980dcd0

Please sign in to comment.