Add calling code and skeleton driver to make tests pass
This commit is contained in:
parent
0a4ec13323
commit
181bb0ba23
|
@ -96,6 +96,8 @@ type Driver interface {
|
|||
|
||||
PreserveLegacyExportBehaviour(string, string) error
|
||||
|
||||
MoveCreatedVHDsToOutputDir(string, string) error
|
||||
|
||||
CompactDisks(string) (string, error)
|
||||
|
||||
RestartVirtualMachine(string) error
|
||||
|
|
|
@ -223,6 +223,12 @@ func (d *HypervPS4Driver) PreserveLegacyExportBehaviour(srcPath string, dstPath
|
|||
return hyperv.PreserveLegacyExportBehaviour(srcPath, dstPath)
|
||||
}
|
||||
|
||||
func (d *HypervPS4Driver) MoveCreatedVHDsToOutputDir(srcPath string, dstPath string) error {
|
||||
// Not implemented yet
|
||||
err := fmt.Errorf("Not implemented yet")
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *HypervPS4Driver) CompactDisks(path string) (result string, err error) {
|
||||
return hyperv.CompactDisks(path)
|
||||
}
|
||||
|
|
|
@ -22,11 +22,20 @@ func (s *StepCollateArtifacts) Run(_ context.Context, state multistep.StateBag)
|
|||
ui.Say("Collating build artifacts...")
|
||||
|
||||
if s.SkipExport {
|
||||
// Get the path to the main build directory from the statebag
|
||||
var packerTempDir string
|
||||
if v, ok := state.GetOk("packerTempDir"); ok {
|
||||
packerTempDir = v.(string)
|
||||
}
|
||||
// If the user has chosen to skip a full export of the VM the only
|
||||
// artifacts that they are interested in will be the VHDs
|
||||
|
||||
// TODO: Grab the disks from the build directory and place them in
|
||||
// a folder named 'Virtual Hard Disks' under the output directory
|
||||
err := driver.MoveCreatedVHDsToOutputDir(packerTempDir, s.OutputDir)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error moving VHDs from build dir to output dir: %s", err)
|
||||
state.Put("error", err)
|
||||
ui.Error(err.Error())
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
} else {
|
||||
// Get the full path to the export directory from the statebag
|
||||
var exportPath string
|
||||
|
|
Loading…
Reference in New Issue