Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugins/providers/hyperv/action/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ def call(env)
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
Expand Down
11 changes: 11 additions & 0 deletions plugins/providers/hyperv/scripts/has_vmcx_support.ps1
Original file line number Diff line number Diff line change
@@ -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)