providers/virtualbox: many `detail` level output

This commit is contained in:
Mitchell Hashimoto 2014-01-17 18:15:52 -08:00
parent b557ee5625
commit 5b449c8000
5 changed files with 23 additions and 12 deletions

View File

@ -240,13 +240,9 @@ module Vagrant
opts ||= {}
opts[:scope] = @scope
if !opts.has_key?(:prefix) || opts[:prefix]
first = true
prefix = "#{@scope}: "
prefix_blank = " " * prefix.length
message = message.split("\n").map do |line|
scope = first ? prefix : prefix_blank
first = false
"#{scope}#{line}"
"#{prefix}#{line}"
end.join("\n")
end
@ui.send(method, message, opts)

View File

@ -7,11 +7,13 @@ module VagrantPlugins
end
def call(env)
env[:ui].output(I18n.t("vagrant.virtualbox.checking_guest_additions"))
# Use the raw interface for now, while the virtualbox gem
# doesn't support guest properties (due to cross platform issues)
version = env[:machine].provider.driver.read_guest_additions_version
if !version
env[:ui].warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected")
env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.not_detected"))
else
# Read the versions
versions = [version, env[:machine].provider.driver.version]
@ -29,7 +31,7 @@ module VagrantPlugins
vb_version = versions[1]
if guest_version != vb_version
env[:ui].warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
env[:ui].detail(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
:guest_version => version,
:virtualbox_version => vb_version))
end

View File

@ -25,7 +25,7 @@ module VagrantPlugins
end
end
env[:ui].info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
env[:ui].output(I18n.t("vagrant.actions.vm.forward_ports.forwarding"))
forward_ports
@app.call(env)
@ -47,7 +47,7 @@ module VagrantPlugins
# because the VM is using Virtualbox NAT networking. Host-only
# bridged networking don't require port-forwarding and establishing
# forwarded ports on these attachment types has uncertain behaviour.
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
@env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry",
message_attributes))
# Verify we have the network interface to attach to
@ -61,7 +61,7 @@ module VagrantPlugins
# Port forwarding requires the network interface to be a NAT interface,
# so verify that that is the case.
if interfaces[fp.adapter][:type] != :nat
@env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.non_nat",
@env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.non_nat",
message_attributes))
next
end

View File

@ -104,7 +104,16 @@ module VagrantPlugins
if !adapters.empty?
# Enable the adapters
@logger.info("Enabling adapters...")
env[:ui].info I18n.t("vagrant.actions.vm.network.preparing")
env[:ui].output(I18n.t("vagrant.actions.vm.network.preparing"))
adapters.each do |adapter|
env[:ui].detail(I18n.t(
"vagrant.virtualbox.network_adapter",
adapter: adapter[:adapter].to_s,
type: adapter[:type].to_s,
extra: "",
))
end
env[:machine].provider.driver.enable_adapters(adapters)
end

View File

@ -124,6 +124,10 @@ en:
The 'run_file' specified could not be found.
virtualbox:
checking_guest_additions: |-
Checking for guest additions in VM...
network_adapter: |-
Adapter %{adapter}: %{type}%{extra}
config:
id_in_pre_import: |-
The ':id' parameter is not available in "pre-import" customizations.
@ -1114,7 +1118,7 @@ en:
Fixed port collision for %{guest_port} => %{host_port}. Now on port %{new_port}.
forwarding: Forwarding ports...
forwarding_entry: |-
-- %{guest_port} => %{host_port} (adapter %{adapter})
%{guest_port} => %{host_port} (adapter %{adapter})
non_nat: |-
VirtualBox adapter #%{adapter} not configured as "NAT". Skipping port
forwards on this adapter.