From a77da314e5fe7054a06a4bb4bf3baf4dd850b609 Mon Sep 17 00:00:00 2001 From: Bjorn Brala Date: Fri, 7 Oct 2016 20:38:05 +0200 Subject: [PATCH] Only check for .vmcx if there is no XML found to not risk breaking older vagrant boxes that added an XML file manually --- plugins/providers/hyperv/action/import.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/providers/hyperv/action/import.rb b/plugins/providers/hyperv/action/import.rb index abc6d02c5..e31949475 100644 --- a/plugins/providers/hyperv/action/import.rb +++ b/plugins/providers/hyperv/action/import.rb @@ -37,19 +37,28 @@ module VagrantPlugins config_path = nil config_type = nil vm_dir.each_child do |f| - if f.extname.downcase == '.xml' config_path = f config_type = 'xml' break end - if f.extname.downcase == '.vmcx' - config_path = f - config_type = 'vmcx' - break + 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 + vm_dir.each_child do |f| + if f.extname.downcase == '.vmcx' + config_path = f + config_type = 'vmcx' + break + end end end + image_path = nil image_ext = nil image_filename = nil