VirtualBox driver should replace only last occurence of suggested VM name.

This commit is contained in:
Akzhan Abdulin 2014-06-24 13:26:40 +04:00 committed by Keith Shook
parent 5530f32922
commit bf2e8deebe
2 changed files with 12 additions and 12 deletions

View File

@ -180,12 +180,12 @@ module VagrantPlugins
disk_params = Array.new
disks = output.scan(/(\d+): Hard disk image: source image=.+, target path=(.+),/)
disks.each do |unit_num, path|
disk_params << "--vsys"
disk_params << "0" #Derive vsys num .. do we support OVF's with multiple machines?
disk_params << "--unit"
disk_params << unit_num
disk_params << "--disk"
disk_params << path.sub("/#{suggested_name}/", "/#{specified_name}/")
disk_params << "--vsys"
disk_params << "0" #Derive vsys num .. do we support OVF's with multiple machines?
disk_params << "--unit"
disk_params << unit_num
disk_params << "--disk"
disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence
end
execute("import", ovf , *name_params, *disk_params) do |type, data|

View File

@ -188,12 +188,12 @@ module VagrantPlugins
disk_params = []
disks = output.scan(/(\d+): Hard disk image: source image=.+, target path=(.+),/)
disks.each do |unit_num, path|
disk_params << "--vsys"
disk_params << "0"
disk_params << "--unit"
disk_params << unit_num
disk_params << "--disk"
disk_params << path.sub("/#{suggested_name}/", "/#{specified_name}/")
disk_params << "--vsys"
disk_params << "0"
disk_params << "--unit"
disk_params << unit_num
disk_params << "--disk"
disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence
end
execute("import", ovf , *name_params, *disk_params) do |type, data|