Harden VMCX support. Vagrant now checks if your Windows version has support for vmcx and then uses the VMCX file.

This commit is contained in:
Bjorn Brala 2016-12-14 15:14:56 +01:00
parent a3b9d231ad
commit f808f74009
2 changed files with 15 additions and 4 deletions

View File

@ -38,18 +38,18 @@ module VagrantPlugins
config_type = nil
vm_dir.each_child do |f|
if f.extname.downcase == '.xml'
@logger.debug("Found XML config...")
config_path = f
config_type = 'xml'
break
end
end
# Only check for .vmcx if there is no XML found to not
# risk breaking older vagrant boxes that added an XML
# file manually
if config_type == nil
vmcx_support = env[:machine].provider.driver.execute("has_vmcx_support.ps1", {})
if vmcx_support
vm_dir.each_child do |f|
if f.extname.downcase == '.vmcx'
@logger.debug("Found VMCX config and support...")
config_path = f
config_type = 'vmcx'
break

View File

@ -0,0 +1,11 @@
# Include the following modules
$Dir = Split-Path $script:MyInvocation.MyCommand.Path
. ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1"))
# Windows version 10 and up have support for binary format
$check = [System.Environment]::OSVersion.Version.Major -ge 10
$result = @{
result = $check
}
Write-Output-Message $(ConvertTo-Json $result)