test-kitchen/kitchen-hyperv

function Mount-VMISO fails, iso_path and boot_iso_path aren't mounting

Opened this issue · 0 comments

iso_path, boot_iso_path are both not working. I've been able to track it down to PowerShell command that won't run.

https://github.com/test-kitchen/kitchen-hyperv/blob/master/support/hyperv.ps1#L225

Add-VMDvdDrive (Get-VM -Id $Id).Name

Won't run, with the following version of powershell:

PS C:\Users\bwright\code\chef_repo\cookbooks\role_clutchdb> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  122

For a work around I was able to replace https://github.com/test-kitchen/kitchen-hyperv/blob/master/support/hyperv.ps1#L225 with:

Add-VMDvdDrive -VMName (Get-VM -Id $Id).Name -Path $Path | Set-VMDvdDrive -VMName (Get-VM -Id $Id).Name -Path $Path

And that fixed my issue. I'm more than happy to open a PR with tweaks/changes but haven't used PowerShell much so curious which version work/have issues. I just don't know if I can just make the change or if I'll need to have a conditional based on version of PowerShell or something along those lines.

Further, if the PowerShell commands fail, Kitchen swallows them and continues. Really seems like a situation that should fail hard and throw an error message.