Cleanup virtualbox retryable commands

Reverting the changes done in 7d2f7dab97
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.
This commit is contained in:
Brian Cain 2017-09-06 11:06:45 -07:00
parent 2e775e8101
commit 9b872c9e7e
1 changed files with 6 additions and 24 deletions

View File

@ -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)