From dc46848f89be30e7c44aaf8aa6cddba157e8f578 Mon Sep 17 00:00:00 2001 From: DanHam Date: Sat, 16 Jun 2018 18:26:39 +0100 Subject: [PATCH] Remove now redundant function to copy exported VM files --- builder/hyperv/common/driver.go | 2 -- builder/hyperv/common/driver_mock.go | 16 ---------------- builder/hyperv/common/driver_ps_4.go | 4 ---- common/powershell/hyperv/hyperv.go | 14 -------------- 4 files changed, 36 deletions(-) diff --git a/builder/hyperv/common/driver.go b/builder/hyperv/common/driver.go index 2f79d8079..08e3f4eac 100644 --- a/builder/hyperv/common/driver.go +++ b/builder/hyperv/common/driver.go @@ -96,8 +96,6 @@ type Driver interface { CompactDisks(string) error - CopyExportedVirtualMachine(string, string, string, string) error - RestartVirtualMachine(string) error CreateDvdDrive(string, string, uint) (uint, uint, error) diff --git a/builder/hyperv/common/driver_mock.go b/builder/hyperv/common/driver_mock.go index 669e47dde..53c7f959b 100644 --- a/builder/hyperv/common/driver_mock.go +++ b/builder/hyperv/common/driver_mock.go @@ -190,13 +190,6 @@ type DriverMock struct { CompactDisks_Path string CompactDisks_Err error - CopyExportedVirtualMachine_Called bool - CopyExportedVirtualMachine_ExpPath string - CopyExportedVirtualMachine_OutputPath string - CopyExportedVirtualMachine_VhdDir string - CopyExportedVirtualMachine_VmDir string - CopyExportedVirtualMachine_Err error - RestartVirtualMachine_Called bool RestartVirtualMachine_VmName string RestartVirtualMachine_Err error @@ -494,15 +487,6 @@ func (d *DriverMock) CompactDisks(path string) error { return d.CompactDisks_Err } -func (d *DriverMock) CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error { - d.CopyExportedVirtualMachine_Called = true - d.CopyExportedVirtualMachine_ExpPath = expPath - d.CopyExportedVirtualMachine_OutputPath = outputPath - d.CopyExportedVirtualMachine_VhdDir = vhdDir - d.CopyExportedVirtualMachine_VmDir = vmDir - return d.CopyExportedVirtualMachine_Err -} - func (d *DriverMock) RestartVirtualMachine(vmName string) error { d.RestartVirtualMachine_Called = true d.RestartVirtualMachine_VmName = vmName diff --git a/builder/hyperv/common/driver_ps_4.go b/builder/hyperv/common/driver_ps_4.go index 2f75a1810..964f4b6a4 100644 --- a/builder/hyperv/common/driver_ps_4.go +++ b/builder/hyperv/common/driver_ps_4.go @@ -223,10 +223,6 @@ func (d *HypervPS4Driver) CompactDisks(path string) error { return hyperv.CompactDisks(path) } -func (d *HypervPS4Driver) CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error { - return hyperv.CopyExportedVirtualMachine(expPath, outputPath, vhdDir, vmDir) -} - func (d *HypervPS4Driver) RestartVirtualMachine(vmName string) error { return hyperv.RestartVirtualMachine(vmName) } diff --git a/common/powershell/hyperv/hyperv.go b/common/powershell/hyperv/hyperv.go index 0a5505b19..d15bd6bd4 100644 --- a/common/powershell/hyperv/hyperv.go +++ b/common/powershell/hyperv/hyperv.go @@ -678,20 +678,6 @@ Get-ChildItem "$srcPath" -Filter *.vhd* | %{ return err } -func CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error { - - var script = ` -param([string]$srcPath, [string]$dstPath, [string]$vhdDirName, [string]$vmDir) -Move-Item -Path (Join-Path (Get-Item $srcPath).FullName "*.*") -Destination $dstPath -Move-Item -Path (Join-Path (Get-Item $srcPath).FullName $vhdDirName) -Destination $dstPath -Move-Item -Path (Join-Path (Get-Item $srcPath).FullName $vmDir) -Destination $dstPath -` - - var ps powershell.PowerShellCmd - err := ps.Run(script, expPath, outputPath, vhdDir, vmDir) - return err -} - func CreateVirtualSwitch(switchName string, switchType string) (bool, error) { var script = `