From 9b872c9e7e9827d7d40eebb7c5cf4ad96d8c69b6 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 6 Sep 2017 11:06:45 -0700 Subject: [PATCH] Cleanup virtualbox retryable commands Reverting the changes done in 7d2f7dab977d51a21381577a5345f96c22142711 because they don't work and or update vagrant to invoke running the vbox cli tool for every single forwarded port instead of forwarding them all in one command. --- .../virtualbox/driver/version_5_0.rb | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/plugins/providers/virtualbox/driver/version_5_0.rb b/plugins/providers/virtualbox/driver/version_5_0.rb index 3e12c4665..3efb31f38 100644 --- a/plugins/providers/virtualbox/driver/version_5_0.rb +++ b/plugins/providers/virtualbox/driver/version_5_0.rb @@ -98,26 +98,7 @@ module VagrantPlugins end def create_snapshot(machine_id, snapshot_name) - execute("snapshot", machine_id, "take", snapshot_name, retryable: true) do |type, data| - if type == :stderr - # Append the data so we can see the full view - total << data.gsub("\r", "") - - # Break up the lines. We can't get the progress until we see an "OK" - lines = total.split("\n") - - # The progress of the import will be in the last line. Do a greedy - # regular expression to find what we're looking for. - match = /.+(\d{2})%/.match(lines.last) - if match - current = match[1].to_i - if current > last - last = current - yield current if block_given? - end - end - end - end + execute("snapshot", machine_id, "take", snapshot_name, retryable: true) end def delete_snapshot(machine_id, snapshot_name) @@ -291,6 +272,7 @@ module VagrantPlugins end def forward_ports(ports) + args = [] ports.each do |options| pf_builder = [options[:name], options[:protocol] || "tcp", @@ -299,11 +281,11 @@ module VagrantPlugins options[:guestip] || "", options[:guestport]] - args = ["--natpf#{options[:adapter] || 1}", - pf_builder.join(",")] - - execute("modifyvm", @uuid, *args, retryable: true) + args.concat(["--natpf#{options[:adapter] || 1}", + pf_builder.join(",")]) end + + execute("modifyvm", @uuid, *args, retryable: true) if !args.empty? end def get_machine_id(machine_name)