providers/virtualbox: more hints when choosing interface [GH-4463]

This commit is contained in:
Mitchell Hashimoto 2014-10-23 10:24:07 -07:00
parent c852d82b61
commit 4ffaaf119e
2 changed files with 10 additions and 3 deletions

View File

@ -184,12 +184,15 @@ module VagrantPlugins
else else
# More than one bridgable interface requires a user decision, so # More than one bridgable interface requires a user decision, so
# show options to choose from. # show options to choose from.
@env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.available", @env[:ui].info I18n.t(
prefix: false) "vagrant.actions.vm.bridged_networking.available",
prefix: false)
bridgedifs.each_index do |index| bridgedifs.each_index do |index|
interface = bridgedifs[index] interface = bridgedifs[index]
@env[:ui].info("#{index + 1}) #{interface[:name]}", prefix: false) @env[:ui].info("#{index + 1}) #{interface[:name]}", prefix: false)
end end
@env[:ui].info(I18n.t(
"vagrant.actions.vm.bridged_networking.choice_help")+"\n")
# The range of valid choices # The range of valid choices
valid = Range.new(1, bridgedifs.length) valid = Range.new(1, bridgedifs.length)
@ -197,7 +200,8 @@ module VagrantPlugins
# The choice that the user has chosen as the bridging interface # The choice that the user has chosen as the bridging interface
choice = nil choice = nil
while !valid.include?(choice) while !valid.include?(choice)
choice = @env[:ui].ask("What interface should the network bridge to? ") choice = @env[:ui].ask(
"What interface should the network bridge to? ")
choice = choice.to_i choice = choice.to_i
end end

View File

@ -1466,6 +1466,9 @@ en:
Enabling bridged network... Enabling bridged network...
preparing: |- preparing: |-
Preparing bridged networking... Preparing bridged networking...
choice_help: |-
When choosing an interface, it is usually the one that is
being used to connect to the internet.
specific_not_found: |- specific_not_found: |-
Specific bridge '%{bridge}' not found. You may be asked to specify Specific bridge '%{bridge}' not found. You may be asked to specify
which network to bridge to. which network to bridge to.